Completed Project Has Timeout Error - WARNING: after_script could not run to completion because the timeout was exceeded

The job finishes well within the timeout limits, but we still get an error that it timed out,

Running with gitlab-runner 17.11.1 (96856197), runner type shell, RHEL8

Runner yaml file - main job

  timeout: 24h  # The entire job can run for maximum 24 hours
  variables:
    RUNNER_SCRIPT_TIMEOUT: 23h # allow 1h for uploading results in the after_script
  script:
     - echo "GIT Stage $CI_JOB_ID $CI_JOB_NAME $CI_JOB_STAGE Started `date; SECONDS=0`" 
     ....
     - echo " ================= End at `date +'%Y-%m-%d %H:%M:%S'` ================"
     - exit $NUM_TEST_FAILURES

Log file showing the main job completes successfully

GIT Stage 199274 system-tests stage-test Started Mon May 19 19:20:50 AEST 2025
...
================= End at 2025-05-20 07:56:18 ================

Then it starts the - after_script which also finishes successfully

after_script:
    - echo " ============ Finalise Starting `date +'%Y-%m-%d %H:%M:%S'` =========="
    ....
    - echo " ================= Finished Processing Log at `date +'%Y-%m-%d %H:%M:%S'` ================"

Running after_script

Log file showing the after script also completing successfully after a few minutes

Running after script...
$ echo " ============ Finalise Starting `date +'%Y-%m-%d %H:%M:%S'` =========="
 ============ Finalise Starting 2025-05-20 07:56:22 ==========
...
$ echo " ================= Finished Processing Log at `date +'%Y-%m-%d %H:%M:%S'` ================"
 ================= Finished Processing Log at 2025-05-20 08:03:43 ================
WARNING: after_script could not run to completion because the timeout was exceeded. For more control over job and script timeouts see: https://docs.gitlab.com/ci/runners/configure_runners/#set-script-and-after_script-timeouts
WARNING: after_script failed, but job will continue unaffected: signal: terminated
Cleaning up project directory and file based variables 00:00
Edited by Robert Rochford