{"version":"2.1.228","anchor":"self-hosted-runners-wait-for-a-just-finished-background-task","canonical_anchor":"self-hosted-runners-wait-for-a-just-finished-background-task","heading":"Self-hosted runners wait for a just-finished background task before shutting down","tier":"use","area":"Self-Hosted Runner","scope":null,"heads_up":null,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.228\/e\/self-hosted-runners-wait-for-a-just-finished-background-task","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.228","markdown":"### Self-hosted runners wait for a just-finished background task before shutting down\n\nSelf-hosted runners hold shutdown until a finished background task is read; the grace window is configurable.\n\n**What**\n\nOn self-hosted runners, a background task that has finished still counts as in-flight until the next turn reads its result, so drain and shutdown wait for it. The window is capped by `SELF_HOSTED_RUNNER_BG_RESULT_GRACE_MS` in milliseconds; setting it to 0 or an unusable value falls back to the default, so the hold cannot be turned off.\n\n**Details**\n\n- The drain-wait help text documents the new hold and the fallback behaviour.\n- The session runner records that a follow-up turn is pending and logs when the wait runs past the normal retire grace period.\n\n**Usage**\n\n`SELF_HOSTED_RUNNER_BG_RESULT_GRACE_MS=5000 claude` **Evidence** `SELF_HOSTED_RUNNER_BG_RESULT_GRACE_MS`\n\n- Area: Self-Hosted Runner\n- Names: `SELF_HOSTED_RUNNER_BG_RESULT_GRACE_MS`\n- Tier: Use it now\n- Useful: 2\/5\n- Signal: 3\/5"}