Skip to content

Comments

feat: wire lifecycle reactions to notifier for push-not-pull PR reviews#130

Open
AgentWrapper wants to merge 1 commit intomainfrom
feat/LIFECYCLE-NOTIFIER
Open

feat: wire lifecycle reactions to notifier for push-not-pull PR reviews#130
AgentWrapper wants to merge 1 commit intomainfrom
feat/LIFECYCLE-NOTIFIER

Conversation

@AgentWrapper
Copy link
Collaborator

Summary

  • Adds automated review comment detection to the lifecycle polling loop
  • When unresolved PR review comments are detected, transitions session to review_comments_unresolved status and triggers the review-comments reaction (sends fix instructions to the agent automatically)
  • Prevents mergeable status when there are pending review comments
  • New ao lifecycle start/check CLI commands replace manual ao review-check polling

Changes

Core types (types.ts):

  • New review_comments_unresolved session status
  • New reviewCommentsSeen field on SessionMetadata for dedup tracking

Lifecycle manager (lifecycle-manager.ts):

  • determineStatus() now calls getPendingComments() and tracks seen comment IDs
  • pendingCommentsCache Map avoids redundant API calls within a single poll cycle
  • Re-triggers reaction when new comments appear while already in review_comments_unresolved
  • Blocks mergeable status when pending comments exist (approved + green CI but unresolved threads)

Config (config.ts):

  • New review-comments default reaction: auto send-to-agent, 2 retries, escalates after 30m

CLI:

  • New ao lifecycle start (foreground polling) and ao lifecycle check <session> commands
  • Deprecation notice on ao review-check (still functional)

Replaces

Replaces #63 (closed due to conflicts with #58 hash-based metadata architecture). Clean re-implementation on current main.

Test plan

  • All 131 tests pass
  • Lint clean (0 errors)
  • Build passes (web typecheck failures are pre-existing)
  • Manual: ao lifecycle start polls and detects review comments
  • Manual: Agent receives fix instructions when comments appear
  • Manual: Duplicate comments don't re-trigger reaction

Generated with Claude Code

Add automated review comment detection to the lifecycle polling loop.
When unresolved review comments appear on a PR, the lifecycle manager
transitions to `review_comments_unresolved` status and triggers the
`review-comments` reaction (sends fix instructions to the agent).

Key changes:
- New `review_comments_unresolved` session status with full type support
- Review comment detection in `determineStatus()` with dedup via
  `reviewCommentsSeen` metadata field (comma-separated comment IDs)
- `pendingCommentsCache` avoids redundant API calls within a poll cycle
- Re-triggers reaction when new comments appear on already-unresolved PRs
- Blocks `mergeable` status when pending comments exist
- New `ao lifecycle start/check` CLI commands for polling management
- Deprecation notice on `ao review-check` (still functional)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

// Update seen-tracking for comment dedup
const currentCommentIds = pendingComments.map((c) => c.id).join(",");
const seenIds = session.metadata?.["reviewCommentsSeen"] || "";
if (currentCommentIds !== seenIds) {
Copy link

Choose a reason for hiding this comment

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

Order-dependent comment ID comparison breaks dedup logic

Medium Severity

The comment dedup mechanism builds currentCommentIds via pendingComments.map((c) => c.id).join(",") without sorting the IDs first. The GitHub GraphQL API does not guarantee a stable ordering for reviewThreads, and the filter step (removing resolved/bot threads) can further change relative ordering between polls. When the same set of unresolved comments is returned in a different order, the joined string differs from the saved reviewCommentsSeen value, causing a false "new comments" detection. This triggers unnecessary metadata writes and — in the re-trigger block — sends duplicate fix instructions to the agent, defeating the dedup design.

Additional Locations (2)

Fix in Cursor Fix in Web

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