feat: include rationale in browserless_agent analytics event#147
feat: include rationale in browserless_agent analytics event#147devin-ai-integration[bot] wants to merge 2 commits into
Conversation
Co-Authored-By: Sean Yang <sean@browserless.io>
Original prompt from Sean Yang
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
Warning Review limit reached
More reviews will be available in 57 minutes and 28 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. WalkthroughThe ChangesBrowserless agent analytics
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/tools/agent.ts`:
- Line 379: The `rationale` value is being forwarded from `fireToolRequest(...)`
into analytics without enforcement, so validate/redact it before use. Update
`AgentParamsSchema` and the `fireToolRequest` path to ensure `params.rationale`
is truncated and stripped of URLs/credentials before assigning it, while still
allowing null when absent. Use the existing `rationale` field in
`AgentParamsSchema` and the `fireToolRequest` call site as the main places to
apply the fix.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
Co-Authored-By: Sean Yang <sean@browserless.io>
Summary
rationale: params.rationale ?? nullto thesendAnalyticsclosure insrc/tools/agent.ts, so everyMCP Tool Requestevent forbrowserless_agentnow includes the LLM-supplied intent string.Changes
In
src/tools/agent.ts(thesendAnalyticsclosure ~line 367), the properties object passed toanalytics?.fireToolRequest(token, 'browserless_agent', {...})now includes:rationaleis a top-level optional string onAgentParamsSchema(defined insrc/tools/schemas.ts:700-716) — a ≤50-char present-continuous label the LLM provides per call (e.g. "Logging in", "Filling the search form").Privacy note:
event_propertiesare sent to SQS (seesrc/lib/analytics.ts). This change now ships the free-textrationalestring — which is LLM-generated intent, not raw end-user conversation — through the same pipeline. The field is capped at 50 chars by schema description and contains only action summaries, so the added PII exposure is minimal.Test plan
npm testpasses locally (439 passing)npm run buildpasses locally (type-checks clean)Checklist
Link to Devin session: https://app.devin.ai/sessions/679a080a73264dda9026d574edb4874c
Requested by: @xsvfat
Summary by CodeRabbit