Skip to content

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

Description

@baofu115

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions