The GitHub Actions job "CI" on rocketmq-dashboard.git/fix/metrics-tool-range 
has failed.
Run started by GitHub user unbridled-41 (triggered by unbridled-41).

Head commit for run:
4ee95a5b99929d37f428f4da82f6bc46aa09a2c0 / unbridled-41 
<[email protected]>
fix(ai): keep a metrics provider's status when a tool query is rejected

The tool error boundary mapped only BusinessException, so the provider's own
verdict was flattened:

    } catch (BusinessException exception) {
        throw ToolExecutionException.from(exception);
    } catch (RuntimeException exception) {
        throw ToolError.UNEXPECTED_EXECUTION_FAILURE.exception();   // 500
    }

A metrics backend answers a validateable query with a 4xx
(AbstractPrometheusCompatibleMetricsSource: "Metric query start must be 
positive",
"Metric query end must be positive", ...) via PrometheusException, a plain
RuntimeException. So `POST /api/ai/tools/rmq.instance.metrics/execute` (or 
`rmqctl
instance metrics --start 0 --end 60`) reported HTTP 500 "Tool execution failed
unexpectedly." for a request the REST endpoint refuses with
400 "Metric query start must be positive" - the one actionable part of the 
answer
was discarded and a client-input error was reported as a service fault, leaving 
the
caller unable to correct the request.

Map PrometheusException through the same translation as a BusinessException, so 
the
provider's status and message survive; a genuine backend outage (the provider's 
own
502) is reported as such instead of a 500.

Tests (server/): mvn -o -B -ntp test 
-Dtest='org.apache.rocketmq.studio.ops.ai.tool.**,MetricsControllerTest,PrometheusMetricsSourceTest'
-> Tests run: 206, Failures: 0, Errors: 0.
- new 
ToolExecutorInvocationTest#keepsTheMetricsProviderStatusWhenAQueryIsRejectedTest
  fails before this change ("Tool execution failed unexpectedly.") and passes 
after
  it, asserting the 400 and the provider's message.
- checkstyle passes.

Report URL: 
https://github.com/apache/rocketmq-dashboard/actions/runs/37991167512

With regards,
GitHub Actions via GitBox

Reply via email to