Repository navigation
ADFA-7286: AI Agent Claude 1.0.1: drop whitespace-only stop sequences - #193
davidschachterADFA wants to merge 1 commit into
Conversation
ClaudeRequestBuilder dropped only empty stop sequences, so a stop of "\n\n" reached Anthropic's Messages API, which rejects whitespace-only stop sequences with a 400. AI Code Suggestions sends exactly that, so every suggestion request failed. The filter now drops blank stops, so a whitespace-only stop no longer cuts the reply and no longer fails the call. Tests cover the blocking path suggestions use, a list of only whitespace stops (no stop_sequences key), and a whitespace stop beside a real one. Version 1.0.1 (code 2). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAZWMkFWJh7CY7P4kCH
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
ADFA-7286: AI Agent Claude drops a whitespace-only stop sequence instead of sending it.
Problem. With AI Agent Claude as AI Core's backend, AI Code Suggestions never shows a suggestion: every request fails with "stop_sequences: each stop sequence must contain non-whitespace". AI Code Suggestions asks for a
"\n\n"stop, andClaudeRequestBuilderdropped only empty stop sequences, so the blank one reached the Messages API, which rejects the whole request.Fix.
ClaudeRequestBuilderfilters stop sequences withisNotBlank(). A whitespace-only stop is dropped, so it no longer cuts the reply; the KDoc says so. No caller depends on one: the agent and tool paths set no stop sequences, and a whitespace-only stop could only ever fail the request.This PR fixes the bug for any version of AI Code Suggestions. The companion PR #194 stops AI Code Suggestions sending stop sequences at all; either one alone fixes it.
Tests (
ClaudeRequestBuilderTest, blocking path, as suggestions use):givenStopSequences_whenBuilt_thenOnlyTheNonBlankOnesAreSent:"", "END"sends onlyEND.givenOnlyWhitespaceStopSequences_whenBuilt_thenNoStopSequencesAreSent:"\n\n", " "sends nostop_sequenceskey.givenABlankAndARealStopSequence_whenBuilt_thenOnlyTheRealOneIsSent: AI Code Suggestions' old list"\n\n", "```"sends only the fence.With the filter put back to
isNotEmpty(), the two new tests fail.Version. 1.0.1, versionCode 2. Open PR #191 (ADFA-7340) also takes AI Agent Claude to 1.0.1/2, and git merges the two without a conflict: whichever merges second must be bumped to 1.0.2/3 before it merges. #191's description says the same.
Checks at 4d77066:
testDebugUnitTest(212 tests),assemblePlugin(no warnings) andaddons checkpass. The.cgprecords revision4d770662317c(not dirty).Not covered. No device check against the real API: AI Agent Claude's base URL is fixed to api.anthropic.com, and no Claude key is available for the test phone. A tester with a key can check it with the Steps to QA on ADFA-7286.
The plan and its independent review are on ADFA-7286 (comment 41762).
🤖 Generated with Claude Code
https://claude.ai/code/session_01Vh2DAZWMkFWJh7CY7P4kCH