jingchangshi's sessions got "claude-opus-5-5 refused this request (safety
filter: refusal) via Claude Code" 19 times, with nothing to say which of
Anthropic's classifier categories (cyber, bio, frontier_llm,
reasoning_extraction, general_harms…) it was. Anthropic sends that in
stop_details beside stop_reason "refusal"; magpie read only stop_reason.
Rather than the separate opt-in JSONL sink the issue proposes, the
category goes where every refused attempt is already recorded: the note
of that try on the Routing page, including a try a later key or group
member answered after, and the error the agent gets when nobody is left.
It is the vendor's own words, so nothing of the user's request is stored
anywhere new.
What changed:
- refusedDetail: "safety filter: refusal (category cyber: <explanation>)",
the explanation whitespace-folded and cut at 200 characters; a null or
missing category or explanation adds nothing, an unknown category is
kept as given. Used for a streamed message_delta and a whole reply.
- stop_details is carried through the IR (Event.StopDetails,
Result.StopDetails) from an Anthropic upstream's stream and from the
claude CLI's stream-json (a Claude subscription), and written back into
an Anthropic client's message_delta or whole reply, as
safeguard_results already is.
What was run:
- TestRefusalKeepsStopDetails (stream, whole, nulls, absent, unknown
category, long explanation), TestRefusalCategoryOnTheTry (refused key
then an answering one: the refused try says "category cyber") and
TestClaudeSubscriptionRefusalMovesToNextAccount (now with stop_details
in the CLI's refusal) fail on the old code and pass now; the refusal,
safeguard and Anthropic tests pass.
Not verified: no real Anthropic refusal with stop_details seen (the
bytes follow Anthropic's documented shape); a Codex or Chat client
served by Claude gets the category on the try only when the hold
writer sees it in its own protocol, which Responses and Chat have no
field for, so their try notes stay "safety filter: …" as before.