Skip to content

Add messagesApi.refusal telemetry and remove noisy unknownContentBlock event#311718

Merged
bhavyaus merged 1 commit intomainfrom
dev/bhavyau/refusal-telemetry
Apr 21, 2026
Merged

Add messagesApi.refusal telemetry and remove noisy unknownContentBlock event#311718
bhavyaus merged 1 commit intomainfrom
dev/bhavyau/refusal-telemetry

Conversation

@bhavyaus
Copy link
Copy Markdown
Collaborator

@bhavyaus bhavyaus commented Apr 21, 2026

Summary

  • Add dedicated messagesApi.refusal telemetry event that fires when Anthropic returns stop_reason === 'refusal', capturing the stop_details.category (e.g. cyber, content_policy). This enables tracking cyber refusals and other policy blocks in telemetry.
  • Parse stop_details from message_delta stream events and store on the processor.
  • Remove messagesApi.unknownContentBlock telemetry — this was firing on every text content block start, producing noise instead of actionable signal. Unrecognized content block types are now silently ignored (their content is still handled via content_block_delta).

Telemetry

New event: messagesApi.refusal

  • requestId — for correlation
  • model — the model that produced the refusal
  • category — the refusal category (e.g. cyber, content_policy)

Copilot AI review requested due to automatic review settings April 21, 2026 16:07
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 21, 2026

Screenshot Changes

Base: 4dabc9bb Current: f05e0f55

Changed (1)

editor/inlineCompletions/other/JumpToHint/Dark
Before After
before after

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves Anthropic Messages API telemetry by adding a dedicated refusal event (with category) while removing a noisy “unknown content block” event that was triggering on common block types.

Changes:

  • Add parsing/storage of delta.stop_details from the Messages API stream.
  • Emit new messagesApi.refusal telemetry when stop_reason === 'refusal', capturing the refusal category.
  • Remove messagesApi.unknownContentBlock telemetry to reduce noise from benign content_block_start events.
Show a summary per file
File Description
extensions/copilot/src/platform/endpoint/node/messagesApi.ts Parses stop_details, adds refusal telemetry, and removes noisy unknown content block telemetry/logging.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 1

Comment thread extensions/copilot/src/platform/endpoint/node/messagesApi.ts
@bhavyaus bhavyaus enabled auto-merge (squash) April 21, 2026 16:14
…k event

- Add dedicated messagesApi.refusal telemetry event that fires on Anthropic
  refusals, capturing the stop_details category (e.g. cyber, content_policy)
- Parse stop_details from message_delta stream events
- Remove messagesApi.unknownContentBlock telemetry which was firing on every
  text content_block_start, producing noise instead of actionable signal
@bhavyaus bhavyaus force-pushed the dev/bhavyau/refusal-telemetry branch from fc5b139 to 5191b2d Compare April 21, 2026 17:20
@bhavyaus bhavyaus merged commit 4253b36 into main Apr 21, 2026
26 checks passed
@bhavyaus bhavyaus deleted the dev/bhavyau/refusal-telemetry branch April 21, 2026 17:43
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.

3 participants