Skip to content

Improve Duo Chat error classification

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

This is blocked by Log error status of v2 chat agent correctly (gitlab-org/modelops/applied-ml/code-suggestions/ai-assist#638 - closed)

Proposal

Address the following comment:

https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/lib/gitlab/llm/chain/agents/single_action_executor.rb#L58-59

          # TODO: Improve these error messages. See https://gitlab.com/gitlab-org/gitlab/-/issues/479465
          # TODO Handle ForbiddenError, ClientError, ServerError.

https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/lib/gitlab/duo/chat/step_executor.rb#L101

          # TODO: Improve error handling

A few notes:

Anti-pattern

V1's following error handling is an example of anti-pattern:

https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/lib/gitlab/llm/chain/agents/zero_shot/executor.rb#L83-89

            rescue Gitlab::Llm::AiGateway::Client::ConnectionError => error
              Gitlab::ErrorTracking.track_exception(error)
              Answer.error_answer(
                error: error,
                context: context,
                error_code: "A1001"
              )
  • Sending HTTP request to AI Gateway and getting response.success? == false means there are multiple possibilities:
    • Client-side error (4xx): We wrongly compose a request to Anthropic. The bug exists in our code.
    • Server-side error (5xx): Anthropic failed to process our request even though it's correctly composed. The bug exists in their code.
    • The HTTP request didn't reach AI Gateway. It's a network configuration issue e.g. a wrong address is set to AI_GATEWAY_URL, AI Gateway is not up, firewall issue, etc.
    • etc

Hence, the error is not actionable for both of end-users and us.

Out of scope

  • Use the exception to improve the resiliency. This is future iteration.

Related

https://gitlab.slack.com/archives/C053WFAK56U/p1723747844526719

Edited by 🤖 GitLab Bot 🤖