Repository navigation
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.
|
Reviewed head
I checked the Java SDK implementations in both 3.2.3 and 3.3.0. Their common gRPC request method logs both 304 and 404 at WARN before rethrowing. Java does not currently silence these codes. Keeping 304 silent here is still a reasonable improvement: it is an expected conditional-fetch result, and the Prompt cache preserves the value without notifying listeners. For 404, the new condition affects the shared AI request path, including MCP, Agent and endpoint operations. It therefore removes diagnostics beyond Prompt polling. In particular, an initial subscription to a missing Prompt catches 404, returns Please retain the existing cache semantics: an initial 404 may return Local validation of the current head, before this requested adjustment:
These checks used macOS/Python 3.13.2 with mocked network responses. The Java comparison was source/test inspection; no live Nacos server or Java tests were run. Please rerun CI after updating the PR. The current Actions run is marked failure. Its jobs and check-runs are empty in the queried API results, so I could not establish the failure cause. The successful commit status only covers CLA and should not be treated as a passing CI run. |
A 404 goes through the shared AI request path, so silencing it also hid a missing or mistyped Prompt key, MCP server or agent. Log it at WARN before re-raising, as the Java SDK does. NOT_MODIFIED stays silent, since it is the expected answer to every unchanged Prompt poll, and other errors still log at ERROR.
|
Thanks for the thorough review. Pushed c83d2d3 on top of 0707b5e:
The 46 offline tests across the files you listed pass, and ruff 0.15.5 with the CI rules is clean. On the CI failure: that run has no jobs at all, so it never started; the push should trigger a fresh run, which may need approval since it comes from a fork. |
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.