Surface a UI error when the agent plan GraphQL query fails in work_item_ai_widget.vue

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

Why

Follow-up from review of !254260 (merged) ("Read the workplan readiness score from GraphQL").

In this review comment, @kushalpandya asked:

Question (non-blocking): I see this was moved over from ee/app/assets/javascripts/work_items/components/ai_widget/work_plan.vue, but do we not want to notify user for any failure on UI?

When the agent plan query was moved up from work_plan.vue into work_item_ai_widget.vue, no user-facing error handling came with it. If the agent plan / readiness score GraphQL query fails, the user currently gets no feedback on the UI.

What

Notify the user when the agent plan GraphQL query in work_item_ai_widget.vue fails, consistent with how errors are surfaced elsewhere in the work item widgets (e.g. an alert / flash on error).

How

  • Add an error handler to the Apollo query in ee/app/assets/javascripts/work_items/components/ai_widget/work_item_ai_widget.vue that surfaces a user-facing message on failure.
  • Follow the existing error-notification pattern used in the work item components.
  • Add / update specs to cover the failure path.

This was flagged as non-blocking, so !254260 (merged) can proceed without it.

Edited by 🤖 GitLab Bot 🤖