Skip to content

fix(agents): persist Anthropic refusal explanations - #660

Merged
jdchawla29 merged 2 commits into
mainfrom
asa/claude-refusal-details
Sep 11, 2026
Merged

jdchawla29 merged 2 commits into
mainfrom
asa/claude-refusal-details

Conversation

@solvemproblr

Copy link
Copy Markdown
Contributor

Summary

  • Claude HTTP 200 refusals (stop_reason=refusal) put the policy category and explanation on stop_details, but ClaudeAgent only copied stop_reason and left AgentStep.refusal empty.
  • The trace UI already displays event.refusal; this copies Anthropic's explanation (or the category when explanation is missing) so Fable/Opus classifier refusals show the real reason instead of "The model refused this request."

Test plan

  • uv run pytest hud/agents/tests/test_claude_agent.py -q (19 passed)
  • Confirm a hosted Fable 5.1 refusal after the SDK pin is bumped shows the usage-policy text on the agent message

Made with Cursor

HTTP 200 refusals put the policy category and explanation on stop_details; copy that onto AgentStep.refusal so the trace UI can show the real reason.

Co-authored-by: Cursor <cursoragent@cursor.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 using high effort and found 1 potential issue.

Fix All in Cursor

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

Reviewed by Cursor Bugbot for commit 4b3bd22. Configure here.

Comment thread hud/agents/claude/agent.py
@jdchawla29
jdchawla29 merged commit 083f8ef into main Sep 11, 2026
8 checks passed
@solvemproblr solvemproblr mentioned this pull request Sep 14, 2026
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