nacos-group / nacos-group/nacos-sdk-python

[Bug] Expected prompt 304 responses are logged as ERROR by the AI gRPC proxy

Open Beginner friendly
#335 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
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
  1. Create a NacosAIService client.
  2. Subscribe to a prompt using SubscribePromptParam.
  3. Do not modify the prompt.
  4. Wait for the prompt cache polling interval.
  5. 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():

https://github.com/nacos-group/nacos-sdk-python/blob/master/v2/nacos/ai/remote/ai_grpc_client_proxy.py

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.