Skip to content

Add axon-pr-reviewer TaskSpawner to replace cubic-dev-ai#409

Closed
axon-agent[bot] wants to merge 9 commits intomainfrom
axon-task-408
Closed

Add axon-pr-reviewer TaskSpawner to replace cubic-dev-ai#409
axon-agent[bot] wants to merge 9 commits intomainfrom
axon-task-408

Conversation

@axon-agent
Copy link

@axon-agent axon-agent bot commented Feb 22, 2026

Summary

  • Adds a new axon-pr-reviewer TaskSpawner that watches for open PRs labeled ok-to-test and performs automated code reviews
  • Replaces the external cubic-dev-ai GitHub App with axon's own self-development capabilities
  • Updates the self-development README to document the new TaskSpawner

Details

The cubic-dev-ai app provides automated code reviews, PR description summaries, and codebase memory. This PR replaces that functionality with a native axon TaskSpawner that:

  1. Triggers on PRs: Uses githubIssues.types: ["pulls"] with labels: ["ok-to-test"] to watch for PRs ready for review
  2. Reviews the diff: Reads the full PR diff and evaluates correctness, test coverage, style/conventions, security, and simplicity
  3. Posts structured feedback: Posts a review comment with summary, detailed findings, and a verdict (LGTM or changes requested)
  4. Re-reviews on new commits: Uses SHA comparison to detect new commits. The task TTL is set to zero so it is deleted immediately after review, letting the spawner rediscover the PR on the next poll cycle. If the head SHA matches the last reviewed SHA, the review is skipped
  5. Incremental follow-up reviews: On follow-up reviews, focuses on the incremental diff (changes since the last reviewed commit) while using the full PR diff for overall context

The reviewer is read-only — it does not push code or modify files.

Closes #408

Test plan

  • Verify the TaskSpawner YAML is valid against the Axon CRD schema
  • Deploy and confirm it picks up PRs labeled ok-to-test
  • Verify review comments are posted correctly
  • Confirm re-review triggers on new commits and skips when HEAD is unchanged

🤖 Generated with Claude Code

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

Copy link
Collaborator

@gjkim42 gjkim42 left a comment

Choose a reason for hiding this comment

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

I'd like to review the latest diff every time the pr is updated.

@gjkim42
Copy link
Collaborator

gjkim42 commented Feb 22, 2026

/reset-worker

@axon-agent axon-agent bot force-pushed the axon-task-408 branch 2 times, most recently from 774db87 to b52cfaf Compare February 22, 2026 09:04
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 2 files (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="self-development/axon-pr-reviewer.yaml">

<violation number="1" location="self-development/axon-pr-reviewer.yaml:52">
P2: Guard the `capture` call so comments without a "Reviewed commit" line don’t make the jq command fail and force re-reviews.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link
Collaborator

@gjkim42 gjkim42 left a comment

Choose a reason for hiding this comment

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

/reset-worker

name: axon-agent
model: opus
type: claude-code
ttlSecondsAfterFinished: 0
Copy link
Collaborator

Choose a reason for hiding this comment

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

so... this will constantly spawn tasks for the same PR even if it doesn't actually code review it.
it will consume tokens continuously.

What would be the better solution?

gjkim42 and others added 9 commits February 23, 2026 13:45
Introduce a new TaskSpawner that watches for pull requests labeled
ok-to-test and performs automated code reviews, replacing the external
cubic-dev-ai GitHub App.

The reviewer reads the full PR diff, checks it against project
conventions, evaluates correctness, test coverage, style, security, and
simplicity, then posts a structured review comment on the PR.

Closes #408

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove excludeLabels and axon/needs-input labeling so the PR reviewer
re-triggers after Task TTL expires. Add a new-commits check so the
agent skips posting if nothing changed since the last review.

Closes #408

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Set ttlSecondsAfterFinished to 0 so the review task is deleted
immediately after finishing. This lets the spawner rediscover the PR on
the next poll cycle and re-review within ~1 minute of new commits being
pushed, instead of waiting up to 1 hour for the old TTL to expire.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace date-based comparison with SHA comparison when deciding
whether to skip a review. The reviewer now compares the PR head SHA
against the commit_id from the last axon review, which is more
reliable across rebases and force pushes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace broken {owner}/{repo} placeholders with dynamic repo
  detection via `gh repo view` and `gh pr view`
- Add null check for LAST_REVIEWED_SHA so the first review always runs
- Match review comments by "Axon PR Reviewer" instead of "Axon Agent"
  to align with the actual review comment format
- Include reviewed commit SHA in review output for reliable comparison
- Add diagnostic logging for review decisions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Switch review posting from `gh pr review --comment` to `gh pr comment`
so that the skip-review check can reliably find prior reviews via
`gh pr view --json comments`. The previous approach used the reviews
API which required fragile jq filters on user login and body content.

The new approach parses the reviewed commit SHA directly from comment
bodies, making skip detection consistent with the posting mechanism.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add the jq try operator (?) to the capture() call so that comments
matching "Axon PR Reviewer" but lacking a "Reviewed commit" line
silently produce no output instead of erroring and forcing unnecessary
re-reviews.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When the PR has been reviewed before, the reviewer now fetches the
incremental diff (LAST_REVIEWED...HEAD_SHA) in addition to the full
PR diff.  Follow-up review comments use a distinct format that shows
the "Changes since" SHA and focuses feedback on the new commits while
noting whether prior feedback has been addressed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Address review feedback: ttlSecondsAfterFinished: 0 caused the spawner
to continuously create new review tasks every poll cycle (1 minute),
wasting tokens even when the PR had not changed. Switch to TTL 3600s
(matching axon-workers) so the Task persists after completion and
prevents re-spawning. Re-reviews can be triggered via /reset-worker.

Remove the skip-if-already-reviewed logic from the prompt since the
spawner's own deduplication (by task name) now handles this. The agent
still detects previous reviews for incremental diff purposes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

Replace cubic-dev-ai app

1 participant