Repository navigation
v1.10.3: fix declined requests shown as an answer; say Claude declined - #14
Merged
Merged
Conversation
When the API's safety classifiers decline a request, the response is a
normal HTTP 200 with stop_reason "refusal" and no text. The AI tab
showed "(no response)" as the answer and saved it to history; the eval
counted it as an answered run. The bug was already on master.
- send() returns refusal ({ category, explanation } from stop_details,
or null) and drops any partial text, as the API docs advise
- the AI tab shows aiRefusalHtml(): Claude declined, plus the escaped
explanation when there is one; nothing goes to history or the copy
buffer
- AI Eval counts declined runs in the Calls row, leaves them out of
scoring and token averages, and stores each run's refusal
- v1.10.3; CLAUDE.md §13 and §21
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QiRz5pTW83oqNbk2NC7yMR
This was referenced Oct 26, 2026
2 tasks
gitluis
commented
Nov 2, 2026
gitluis
left a comment
Owner
Author
There was a problem hiding this comment.
Fully reviewed. PR is approved.
44 tasks
gitluis
pushed a commit
that referenced
this pull request
Nov 2, 2026
…ettings-database-tab Carries master's v1.10.3-v1.10.5 up the stack: declined answers (#14), literal single "~" (#15) and the Import Logs race fix (#18), with clarity-insights' port of #14 to the rebuilt AI tab. One conflict: CLAUDE.md's "Last updated" line. Kept this branch's line and added the v1.10.3-v1.10.5 history. The CHANGELOG merged cleanly. Versions stay 1.17.0. renderImportLog() keeps #18's guards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013Z8iBXzUjiQbYziDZ8CZft
33 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When Claude declines a question, the AI tab now says so instead of showing "(no response)" as if it were the answer. Found while reviewing #12; the bug was already on
master.Cause
The API's safety classifiers can decline a request. That comes back as a normal HTTP 200 with
stop_reason: "refusal", an emptycontentand astop_detailsobject (category,explanation). It is not an error, so FinLens's error handling never saw it:What changed
js/views-ai.jssend()returnsrefusal:{ category, explanation }fromstop_detailsfor a declined request, otherwisenull. Itstextis the no-text placeholder, so partial text is dropped.aiRefusalHtml(): "Claude declined to answer this question", theexplanationwhen there is one (escaped, and shown rather than parsed, as the docs advise), and a suggestion to ask a different way. Nothing goes to history or the copy buffer.js/views-eval.jsrefusal.index.html, README andviews-settings.js. CLAUDE.md §13 (refusals, raw-mode result) and §21 (declined runs).Not changed: the request, the summary and how answers are scored, so this needs no eval re-run. No automatic retry on another model either: the API's server-side fallback is an opt-in beta (
fallbacks+ a beta header), and can be a separate change if you want it.How it was tested
Headless Chromium, mocked API, on
dbcc911(#12 + #13 + this change, including both eval re-runs). The mocked refusal has the shape the API docs show.explanation: null: the generic message, with no "null" on screen.refusaland the placeholder text for a refusal, andrefusal: nullfor a normal answer.max_tokens4096, the dated summary, re-scoring the v1.10.0 run, mock eval run, no key in exports, no page errors). Every version string says v1.10.3. 41/41 pass.Not verified: a real refusal. Finance questions are unlikely to trigger one, so this relies on the documented response shape.
Please check before merging
$('#aiResponse').innerHTML = aiRefusalHtml({ explanation: 'Example reason.' })Source: Refusals and fallback
Generated by Claude Code