Skip to main content
This lesson shows how to diagnose GitHub Actions job cancellations when using self-hosted runners. You’ll create a minimal workflow that simulates a long-running telemetry stream, trigger and cancel a run from the Actions UI, and inspect the self-hosted runner to determine whether the cancellation was user-initiated or caused by the runner exiting or losing connectivity.

Workflow: Rocket Launch Telemetry Demo

Create a workflow file (for example, .github/workflows/launch-telemetry.yml). This workflow triggers on pushes and manual runs, targets a self-hosted runner, and simulates a 60-second rocket launch sequence by printing telemetry every 5 seconds:
Key points:
  • Triggers: push and workflow_dispatch (manual).
  • runs-on: self-hosted exercises your self-hosted runner.
  • timeout-minutes: 10 limits maximum job time.
  • The step prints telemetry lines every 5 seconds for 60 seconds.
Commit this file to your repository (for example on main) and start a run (or use the Actions UI to trigger it manually).

Actions UI: canceling a run

Open the workflow run in GitHub Actions. If someone clicks Cancel workflow while the run is in progress, the UI marks the run as canceled and the job log typically includes an “operation was canceled” message. The running step will stop producing additional telemetry lines.
Dark-mode screenshot of a GitHub Actions page showing a "Rocket Launch Telemetry Demo" workflow (launch-telemetry.yml) with a listed workflow run. The left sidebar displays other workflows and management options.
Example truncated console output from the long-running step:
To determine if this was a user/API cancel or a runner-side problem, inspect the self-hosted runner host and logs.

Inspecting the self-hosted runner

Self-hosted runner processes are commonly started with ./run.sh. The runner console output shows lifecycle events: connected, listening, running jobs, and job completed/canceled. Example run script output:
Two common causes for a canceled job:
  • A developer or an API call manually canceled the run.
  • The runner process itself exited/stopped while the job was running (e.g., operator stopped it, service restart, system reboot).

Important runner directories: _work and _diag

The two most useful directories inside the runner installation for debugging are: Example top-level runner layout and _work listing:
Inspect the repository workspace inside _work to confirm repository content and any runner-generated temporary scripts:

Reviewing diagnostic logs in _diag

The _diag folder contains Runner_*.log and Worker_*.log files and directories with log blocks. These files typically reveal whether the cancellation was a runner disconnect, socket error, or an explicit cancel by a user/API.
Search runner logs for cancellation-related messages:
Worker logs often show socket/network errors around cancellation events. An example excerpt indicating a canceled transport connection:
Also verify that step logs were uploaded before the job finished/canceled:

Enabling more verbose logs

If logs don’t reveal the cause, enable debug logging for more detail:
  • Set repository-level secrets ACTIONS_STEP_DEBUG and/or ACTIONS_RUNNER_DEBUG to true (use these names exactly).
  • Re-run the workflow or rerun jobs from the Actions UI.
  • Look for additional ##[debug] lines in the workflow log and more verbose entries in Runner_*.log and Worker_*.log.
Example debug output in a workflow run:
Check both the Actions UI workflow logs and the runner host directories (_diag and _work). The UI shows user-facing cancellation; runner logs show whether the runner exited, lost connectivity, or continued to upload logs and cleanup.
Debug logs can reveal secrets or sensitive environment values. Enable ACTIONS_STEP_DEBUG/ACTIONS_RUNNER_DEBUG only in trusted environments and remove the debug secrets when troubleshooting is complete.
  1. Reproduce the run and note whether a user/API canceled it via the Actions UI.
  2. On the self-hosted runner host:
    • Check the run.sh console for runner start/exit messages.
    • Inspect _diag/Runner_*.log and Worker_*.log for socket/broker errors and “Operation canceled” traces.
    • Inspect _work for the job workspace and any generated temporary scripts to confirm the job’s state at cancellation.
  3. Enable ACTIONS_STEP_DEBUG and/or ACTIONS_RUNNER_DEBUG as repository secrets to collect verbose logs if the cause is unclear.
  4. If the runner process exited unexpectedly, investigate the host OS (systemd logs, resource constraints, OOM kills, or administrative restarts).
  5. If a user canceled the run, correlate the cancellation timestamp from the Actions UI with runner logs to confirm whether the runner performed uploads and cleanup after the cancel.
Following this process—examining the Actions UI logs and the runner host _diag and _work folders—will help you determine whether a cancellation was triggered by a user/API call or by runner termination, and will provide diagnostic detail needed to resolve the root cause.

Watch Video