fix #335: stop logging expected AI prompt responses as errors - #336
Open
hdimer wants to merge 1 commit into
Open
fix #335: stop logging expected AI prompt responses as errors#336hdimer wants to merge 1 commit into
hdimer wants to merge 1 commit into
Conversation
The gRPC AI proxy logged every NacosException at ERROR level, so a normal 304 (prompt data is up to date) cache-validation response produced an ERROR line on every prompt poll. The HTTP AI proxy already re-raises NOT_MODIFIED and NOT_FOUND without logging; follow the same idiom here. Other error codes still log at ERROR as before.
hdimer
marked this pull request as ready for review
August 29, 2026 15:48
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.
What type of PR is this?
What does this PR do?
AIGRPCClientProxy.request_ai_serverlogged everyNacosExceptionat ERRORlevel, so a plain
304 / prompt data is up to datecache-validation responseproduced an ERROR line on every prompt poll, even though
PromptCacheHolder._update_prompt_loopalready treatsNOT_MODIFIEDas theexpected outcome and ignores it.
The HTTP AI proxy already has an idiom for this:
_req_apiand_req_api_bytesin
ai_http_client_proxy.pyre-raiseNOT_MODIFIEDandNOT_FOUNDwithoutlogging. This applies the same two lines to the gRPC proxy so both transports
behave the same way. Every other error code still logs at ERROR exactly as
before.
One consequence worth confirming:
subscribe_promptswallowsNOT_FOUNDwithout logging, so subscribing to a prompt that does not exist is now silent
over gRPC. That is already the behaviour on the HTTP transport, so this brings
the two into line, but say the word if you would rather I limit the change to
NOT_MODIFIEDonly.Which issue(s) does this PR fix?
Fixes #335
How has this been tested?
New
test/test_ai_grpc_client_proxy.pycovers three cases: a 304 and a 404response emit no ERROR record and still raise, and a 500 response still logs one
ERROR. The two 304/404 tests fail on
masterand pass with this change. The 500test passes either way and is there to rule out the lazier fix of demoting the
whole
logger.errorcall.Ran locally:
ruff check --select F --ignore F401 --exclude "*/grpcauto/*" v2/,the
import v2.nacossmoke check, and the offline tests undertest/(45 tests,all passing). The tests that need a live Nacos server were not run.
I used an AI assistant while working on this. The reasoning, the tests and the
final code are mine and I have reviewed every line.
Checklist
Used AI assistance on this; I reviewed and tested the change myself.