Skip to content

Agent investigation CLI#165

Draft
R44VC0RP wants to merge 2 commits intomainfrom
cursor/agent-investigation-cli-d2c3
Draft

Agent investigation CLI#165
R44VC0RP wants to merge 2 commits intomainfrom
cursor/agent-investigation-cli-d2c3

Conversation

@R44VC0RP
Copy link
Collaborator

Adds an internal CLI (bun run investigate) for agents to investigate account, domain, tenant, and suppression issues using Neon DB and AWS data.

This CLI provides subcommands for overview, tenant, account, domain, and suppression, incorporating shared risk scoring and optional AWS SES enrichments to help identify abuse patterns and service misuse.

Open in Web Open in Cursor 

Co-authored-by: Ryan Vogel <ryan@inbound.new>
@cursor
Copy link

cursor bot commented Mar 12, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@vercel
Copy link
Contributor

vercel bot commented Mar 12, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
inbound.new Ready Ready Preview, Comment Mar 13, 2026 5:17pm

Request Review

deliveryFailures,
failedSends,
uniqueFailedRecipients,
topRejectedDomainCount: uniqueFailedRecipients,
Copy link

Choose a reason for hiding this comment

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

Domain risk profile uses wrong metric for rejection concentration

Medium Severity

In runDomainCommand, topRejectedDomainCount is set to uniqueFailedRecipients (count of distinct failed recipients), but buildRiskProfile uses this value to detect whether rejections are concentrated on a single recipient domain (checking topRejectedDomainCount / rejectionEventTotal >= 0.6). The other two call sites in listTenantInsights and runAccountCommand correctly pass topRejectedRecipientDomains[0]?.count || 0 — the event count for the single most-rejected domain. This mismatch causes the domain command to produce incorrect risk scores, potentially triggering or missing the concentrated_recipient_domain_rejections flag.

Additional Locations (1)
Fix in Cursor Fix in Web

Co-authored-by: Ryan Vogel <ryan@inbound.new>
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.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

} else {
awsError = `${getErrorName(error)} ${getErrorMessage(error)}`;
}
}
Copy link

Choose a reason for hiding this comment

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

Suppression command ignores withAws flag, always calls AWS

Low Severity

runSuppressionCommand always creates a SES client and calls GetSuppressedDestinationCommand regardless of the --with-aws flag. Every other command gates AWS calls behind input.withAws. This inconsistency means running the suppression command without --with-aws (and without AWS credentials) will always attempt and fail an AWS call, adding latency and producing a potentially confusing awsError in the output.

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.

2 participants