Switch widget UA detection to whitelist#244
Conversation
Now that we've confirmed Claude.ai and Claude Desktop both send "Claude-User", whitelist that UA instead of blocking known non-widget clients. Unknown UAs default to text-only. Also broaden internal client detection to match "everyrow" instead of "everyrow-cc". Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
@claude code review |
|
Claude finished @RafaelPo's task in 1m 7s —— View job Code Review: Switch widget UA detection to whitelist
Overall: Clean, well-documented change. The whitelist approach is the right call — fail-closed is safer than fail-open for widget detection. One real issue to fix; the rest are minor. Stale docstring on
|
Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
@claude code review |
|
Claude finished @RafaelPo's task in 55s —— View job Code Review: Switch widget UA detection to whitelist
Overall: The core change (blocklist → whitelist in 1. Stale docstring in
|
Update client_supports_widgets docstring to reflect whitelist behavior (unknown UAs now default to no widget, not widget). Add parameterized tests for _widgets_from_user_agent and is_internal_client. Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
@claude code review |
|
Claude finished @RafaelPo's task in 45s —— View job Code Review: Switch widget UA detection to whitelist
Overall: Clean PR, ready to merge. The previous review concerns (stale docstring, missing tests) have both been addressed in follow-up commits. No new issues found. Whitelist logic ( Docstring (
Tests ( LGTM. |
Summary
_widgets_from_user_agent()from a blocklist to a whitelist approachClaude-User(sent by both Claude.ai and Claude Desktop) gets widgets; all other UAs default to text-onlyis_internal_client()to match"everyrow"instead of"everyrow-cc"Context
We confirmed the exact UA strings by adding temporary logging to
everyrow_balanceand testing from Claude.ai, Claude Desktop, and Claude Code:Claude-UserClaude-Userclaude-code/2.1.62 (cli)everyrow-cc/1.0Since we now know the widget-capable UAs, a whitelist is safer than a blocklist — unknown clients won't accidentally get widget JSON they can't render.
Test plan
uv run pytest tests/— 372 passed, 28 skipped🤖 Generated with Claude Code