nacos-group / nacos-group/nacos-sdk-python
[Bug] Expected prompt 304 responses are logged as ERROR by the AI gRPC proxy
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 471
- Forks
- 155
- PR merge metrics
- No merged PRs in 30d
Description
Environment
- SDK Package Version: 3.2.0
- Python Version: Python 3.12.13
- Nacos Server Version: 3.2.3
- OS: Windows 11
Describe the Bug
When using the AI Prompt API with the default gRPC transport, an expected
"prompt not modified" response is logged as an ERROR by the SDK.
The response is:
Error [304]: prompt data is up to date
This appears to be a normal cache validation response, not an actual failure.
The prompt cache layer already handles NOT_MODIFIED (304) as an expected
condition and ignores it.
Steps to Reproduce
- Create a
NacosAIServiceclient. - Subscribe to a prompt using
SubscribePromptParam. - Do not modify the prompt.
- Wait for the prompt cache polling interval.
- The SDK receives a response with code
304.
Expected Behavior
A 304 response for an unchanged prompt should not be logged at ERROR level.
Possible options:
- Do not log 304 responses.
- Log them at DEBUG level.
- Log them at INFO level if diagnostic visibility is required.
Unexpected response codes such as 401, 403, 404, 500, connection failures,
and invalid responses should continue to be logged as errors.
Actual Behavior
The SDK logs an ERROR similar to:
failed to invoke nacos config server : Error [304]: prompt data is up to date
This log is emitted from AIGRPCClientProxy.request_ai_server():
The exception is then handled by PromptCacheHolder as an expected
NOT_MODIFIED response.
Relevant code path
The gRPC proxy currently logs every NacosException at ERROR level:
except NacosException as e:
self.logger.error(
"failed to invoke nacos config server : " + str(e)
)
raise e
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at v2/nacos/ai/remote/ai_grpc_client_proxy.py and inspect AIGRPCClientProxy.request_ai_server(), then trace how PromptCacheHolder handles NOT_MODIFIED. Adjust the logging behavior so expected 304 responses are not logged at ERROR while the listed unexpected failures remain errors. Done when unchanged prompt polling no longer emits an ERROR log and other failures still do.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 82/100