Skip to content

fix: normalize the content-filter finish reason (WI-1801) - #423

Merged
stefan-ernst merged 1 commit into
mainfrom
wi-1801-llm-adapter
Nov 2, 2026
Merged

stefan-ernst merged 1 commit into
mainfrom
wi-1801-llm-adapter

Conversation

@stefan-ernst

Copy link
Copy Markdown
Contributor

Fantasy emits the canonical finish reason content-filter, but the agent loop's finalStopReason classified only content_filter. A filtered response fell through to done — or to empty when it carried no text — bypassing the review warning and the failed-run contract.

Change

Normalize provider finish reasons to this package's spelling at the adapter boundary, alongside the existing tool-calls mapping, using Fantasy's constants as the source of truth:

switch finish {
case fantasy.FinishReasonToolCalls:
    finishReason = "tool_calls"
case fantasy.FinishReasonContentFilter:
    finishReason = "content_filter"
}

The loop and every StopReason consumer now read one form.

Tests

Windshiftapp/core-tests-internal#23 — adapter-to-loop coverage for a filtered response with and without partial text. Fails against the pre-fix code with adapter finish reason = "content-filter", want "content_filter".

Fantasy emits the canonical finish reason "content-filter", but the agent
loop classified only "content_filter". A filtered response fell through to
done (or empty when it carried no text), bypassing the review warning and
failed-run contract.

Normalize provider finish reasons to this package's spelling at the adapter
boundary, alongside the existing tool-calls mapping, so the loop and every
StopReason consumer read one form.
@stefan-ernst
stefan-ernst merged commit 3034753 into main Nov 2, 2026
18 checks passed
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.

1 participant