Skip to content

feat: add prompt field for telemetry AUTO-248 - #180

Merged
andyMrtnzP merged 3 commits into
mainfrom
feat/record-prompt-auto-248
Jul 16, 2026
Merged

feat: add prompt field for telemetry AUTO-248#180
andyMrtnzP merged 3 commits into
mainfrom
feat/record-prompt-auto-248

Conversation

@andyMrtnzP

@andyMrtnzP andyMrtnzP commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds optional prompt field for telemetry

Related issues

Closes AUTO-248

Changes

Test plan

  • npm test passes locally
  • npm run lint passes locally
  • npm run coverage thresholds still met
  • Manual smoke test against a real Browserless token (describe below)
  • N/A — docs / chore / refactor only

Checklist

  • I have read CONTRIBUTING.md
  • My commits follow the conventional-commit prefix convention
  • I have updated documentation where relevant (README, CHANGELOG, etc.)
  • I have not introduced new dependencies without flagging them in the summary

Summary by CodeRabbit

  • New Features
    • Added optional prompt context to supported tool requests.
    • Added best-effort redaction for sensitive content included in prompt-related analytics.
    • Compliance mode continues to exclude prompt fields from tool schemas.
  • Analytics
    • Tool activity analytics can now record originating prompt context when present.
  • Tests
    • Added coverage for prompt capture, secret redaction, and compliance mode behavior.
  • Documentation
    • Updated inline documentation for frontmatter parsing behavior (no runtime changes).

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

defineTool now conditionally accepts an LLM-injected _prompt, redacts secrets, passes it through ToolRunContext, and records it in analytics. Agent and crawl tools propagate the prompt, with tests covering redaction and compliance-mode behavior.

Changes

Prompt Context Propagation

Layer / File(s) Summary
defineTool prompt contract and execution handling
src/lib/define-tool.ts, src/lib/utils.ts
Adds conditional _prompt schema support, secret redaction, context propagation, and prompt-aware analytics fields.
Downstream tool analytics propagation
src/tools/agent.ts, src/tools/crawl.ts, test/tools/agent.spec.ts
Propagates prompt context through agent and crawl analytics and tests redaction and compliance-mode suppression.
Frontmatter parser documentation
src/skills/sites.ts
Updates comments to describe the existing minimal frontmatter reader and folded scalar handling.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant LLM
  participant defineTool
  participant Tool
  participant Analytics
  LLM->>defineTool: Invoke with _prompt
  defineTool->>Tool: Pass params and redacted prompt
  Tool->>Analytics: Emit prompt-aware analytics
Loading

Possibly related PRs

Poem

A bunny found a prompt in flight,
Scrubbed its secrets clean and bright.
Tools carried context through the run,
Analytics noted what was done.
Compliance kept the field away—
Hop, hop, safer logs today!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly matches the main change: adding an optional prompt field for telemetry.
Description check ✅ Passed The description covers the summary, related issue, test plan, and checklist, and is mostly complete for the template.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/record-prompt-auto-248

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

@coderabbitai coderabbitai Bot left a comment

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.

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`:
- Around line 516-524: Remove the raw console.log(prompt) call from the agent
handler. If prompt diagnostics are required, route them through the existing log
helper with its redaction behavior, preserving the surrounding handler logic and
parameters.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: baf8615b-b120-4a2a-b9b4-65fef17666e1

📥 Commits

Reviewing files that changed from the base of the PR and between 3b89b8a and e60377e.

📒 Files selected for processing (4)
  • src/lib/define-tool.ts
  • src/tools/agent.ts
  • src/tools/crawl.ts
  • test/lib/define-tool.spec.ts

Comment thread src/tools/agent.ts Outdated

@coderabbitai coderabbitai Bot left a comment

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.

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/lib/utils.ts`:
- Line 85: Update the credential-redaction pattern in the utility to match
JSON-style fields with quoted keys and quoted or unquoted values, while
preserving existing unquoted formats. Add a regression case covering a payload
such as a password field containing a secret and verify the value is redacted
before analytics forwarding.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 99e56381-7112-4ff4-b62f-38a82337f7c9

📥 Commits

Reviewing files that changed from the base of the PR and between e60377e and 948eb91.

📒 Files selected for processing (4)
  • src/lib/define-tool.ts
  • src/lib/utils.ts
  • src/tools/agent.ts
  • test/tools/agent.spec.ts
💤 Files with no reviewable changes (1)
  • src/tools/agent.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/lib/define-tool.ts

Comment thread src/lib/utils.ts Outdated
@andyMrtnzP andyMrtnzP changed the title feat: add prompt field for telemetry feat: add prompt field for telemetry AUTO-248 Jul 15, 2026
@andyMrtnzP
andyMrtnzP merged commit 9a2119c into main Jul 16, 2026
7 checks passed
@andyMrtnzP
andyMrtnzP deleted the feat/record-prompt-auto-248 branch July 16, 2026 17:21
andyMrtnzP pushed a commit that referenced this pull request Jul 16, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.13.0](v1.12.0...v1.13.0)
(2026-07-16)


### Features

* add prompt field for telemetry AUTO-248
([#180](#180))
([9a2119c](9a2119c))
* force updating tool list on client connect AUTO-245
([#181](#181))
([3f526c0](3f526c0))
* get browserless profiles [AUTO-240]
([#179](#179))
([8928462](8928462))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: browserless-actions-bot[bot] <186328842+browserless-actions-bot[bot]@users.noreply.github.com>
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