Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-83147

AI: Placement - Error messages

    • MDL-83147-main
    • Hide

      A. Unit testing

      Unit testing has been created to cover the error handler classes.

      B. Manual testing

      1. Login as admin
      2. Navigate to Site Admin > General > AI Providers
      3. Create a new AI provider OpenAI, with the wrong API key. Keep the site-wide rate limit and user rate limit unchecked. Enabled it.
      4. Navigate to Site Admin > General > AI Placements
      5. Enabled the Course assistance placement and the Text editor placement. Ensure all actions on both placements are enabled.
      6. Navigate to Site Admin > Development > Debugging page. Set the debug messages to NORMAL
      7. Navigate to the edit profile page
      8. In the description. Click the AI generate text on the editor toolbar
      9. Describe the text and then click the Generate text button
      10. VERIFY that there is an error message:
        Something went wrong
        Unable to connect to the AI service. Try again later 
      11. Navigate to Site Admin > Development > Debugging page. Set the debug messages to ALL.
      12. Repeat step 7 - 9
      13. VERIFY that there is an error message:
        401: Unauthorized
        Incorrect API key provided: ****. You can find your API key at https://platform.openai.com/account/api-keys
      14. Edit the provider. Tick the Set user rate limit and then set the Maximum number of requests per user to zero
      15. Repeat step 6 - 9
      16. VERIFY that there is an error message:
        Too Many Requests
        You have reached the maximum number of AI requests you can make in an hour. Try again later 
      17. Navigate to Site Admin > Development > Debugging page. Set the debug messages to ALL.
      18. Repeat step 7 - 9
      19. VERIFY that there is an error message:
        429: Too Many Requests
        You have reached the maximum number of AI requests you can make in an hour. Try again later
      20. Create a course and add a Page resource to it. Ensure you get enough text on the page to get summarised by the AI later on.
      21. At the Page resource. Click the Summarise button.
      22. VERIFY that there is an error message:
        429: Too Many Requests
        You have reached the maximum number of AI requests you can make in an hour. Try again later 
      23. VERIFY that there is no Try again button.
      Show
      A. Unit testing Unit testing has been created to cover the error handler classes. B. Manual testing Login as admin Navigate to Site Admin > General > AI Providers Create a new AI provider OpenAI, with the wrong API key. Keep the site-wide rate limit and user rate limit unchecked. Enabled it. Navigate to Site Admin > General > AI Placements Enabled the Course assistance placement and the Text editor placement. Ensure all actions on both placements are enabled. Navigate to Site Admin > Development > Debugging page. Set the debug messages to NORMAL Navigate to the edit profile page In the description. Click the AI generate text on the editor toolbar Describe the text and then click the Generate text button VERIFY that there is an error message: Something went wrong Unable to connect to the AI service. Try again later  Navigate to Site Admin > Development > Debugging page. Set the debug messages to ALL . Repeat step 7 - 9 VERIFY that there is an error message: 401: Unauthorized Incorrect API key provided: ****. You can find your API key at https://platform.openai.com/account/api-keys .  Edit the provider. Tick the Set user rate limit and then set the Maximum number of requests per user to zero Repeat step 6 - 9 VERIFY that there is an error message: Too Many Requests You have reached the maximum number of AI requests you can make in an hour. Try again later  Navigate to Site Admin > Development > Debugging page. Set the debug messages to ALL . Repeat step 7 - 9 VERIFY that there is an error message: 429: Too Many Requests You have reached the maximum number of AI requests you can make in an hour. Try again later Create a course and add a Page resource to it. Ensure you get enough text on the page to get summarised by the AI later on. At the Page resource. Click the Summarise button. VERIFY that there is an error message: 429: Too Many Requests You have reached the maximum number of AI requests you can make in an hour. Try again later  VERIFY that there is no Try again button.
    • Hide

      Fails against automated checks.

      Checked MDL-83147 using repository: https://github.com/meirzamoodle/moodle.git

      Should these errors be fixed?

      Built on: Mon Apr 28 04:16:50 UTC 2025

      Show
      Fails against automated checks. Checked MDL-83147 using repository: https://github.com/meirzamoodle/moodle.git main [branch: MDL-83147-main | CI Job ] Warn: The MDL-83147 -main branch at https://github.com/meirzamoodle/moodle.git has not been rebased recently (>20 days ago). Error: The MDL-83147 -main branch at https://github.com/meirzamoodle/moodle.git does not apply clean to origin/main Error: Merge conflict(s) in file(s): Error: lang/en/ai.php Should these errors be fixed? Built on: Mon Apr 28 04:16:50 UTC 2025
    • Show
      Launching automatic jobs for branch MDL-83147 -main https://ci.moodle.org/view/Testing/job/DEV.02%20-%20Developer-requested%20PHPUnit/18090/ PHPUnit (sqlsrv) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/61814/ Behat (NonJS - boost and classic) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/61815/ Behat (Firefox - boost) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/61816/ Behat (Firefox - classic) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/61817/ App tests (stable app version) Built on: Tue Jan 28 12:30:19 PM UTC 2025
    • 6
    • Team Hedgehogs 2025 Sprint 2.1, Team Hedgehogs 2025 Sprint 2.2

      Improve the user messages displayed in the placements when an error occurs. Currently, the error message is generic and provides little information on the actual issue.

      Improved error messages can help debugging and troubleshooting efforts.

      The subsystem handles several different error types and provides specific error feedback. This is returned in the Action response object. Currently the placements only surface this error information in a generic way.

      The error displayed should vary based on site debugging settings. So in normal site operations the errors are generic, however, to help with debugging issues site administrators (developers, hosts, etc) can increase the verbosity of the messages by adjusting the debugging level of the site; in the same way as they can currently for other errors.

      The table below shows the most common error codes and the frequency of occurrence, based on current AI subsystem usage stats.

      Error 400 401 404 429
      Percentage 22.67% 25.33% 46.67% 5.33%

      Below is a DRAFT table of messages returned to users based on the level of debugging set for the site. The level that the messages change from "less" to "more" verbose can be confirmed at a later date. The wording/copy of the messages will also need UX review. With the wording of messages we do need to be careful of providing no-admin users information that they can't do anything with or might scare them (yes, this is a real thing).

        LMS Debug Level
      Error < "ALL" >= "ALL"
      Upstream 400 Something went wrong
      Try again later
      400: Bad Request
      <Full upstream error message>
      Upstream 401 Something went wrong
      Try again later
      401: Unauthorized
      <Full upstream error message>
      Upstream 404 Something went wrong
      Try again later
      404: Not found
      <Full upstream error message>
      Upstream 429 Too many requests
      The AI service has responded that your request is being rate limited. Try again later
      429: Too many requests
      <Full upstream error message>
      Internal 429 Too many requests
      You have reached the request limit set by your administrator. Try again later
      429: Too many requests
      You have reached the request limit set by your administrator. Try again later
      Upstream 5xx Something went wrong
      Try again later
      <error code>: <error name>
      <Full upstream error message>
      Internal 5xx Something went wrong
      Try again later
      <error code>: <error name>
      <Full upstream error message>
      Everything else Something went wrong
      Try again later
      <error code>: <error name>
      <Full upstream error message>

        1. MDL-83147_step10.png
          MDL-83147_step10.png
          27 kB
        2. MDL-83147_step13.png
          MDL-83147_step13.png
          28 kB
        3. MDL-83147_step16.png
          MDL-83147_step16.png
          26 kB
        4. MDL-83147_step19.png
          MDL-83147_step19.png
          26 kB
        5. MDL-83147_step22.png
          MDL-83147_step22.png
          76 kB

            meirza.arson@moodle.com Meirza
            matt.porritt@moodle.com Matt Porritt
            Raquel Ortega Raquel Ortega
            Huong Nguyen Huong Nguyen
            Votes:
            6 Vote for this issue
            Watchers:
            23 Start watching this issue

              Created:
              Updated:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 week, 3 days, 4 hours, 2 minutes
                1w 3d 4h 2m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.