Skip to content

Commit c77a233

Browse files
chiphCopilotjc-clark
authored
Document pre-receive hook timeout behavior (#57929)
Co-authored-by: Copilot <[email protected]> Co-authored-by: Joe Clark <[email protected]>
1 parent 7daeb07 commit c77a233

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

content/admin/enforcing-policies/enforcing-policy-with-pre-receive-hooks/about-pre-receive-hooks.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,26 @@ Due to risk of failure and performance impact for all users of your instance, we
4444
> [!NOTE]
4545
> To avoid rejection of a push due to a timeout, all combined pre-receive hooks should run in under five seconds.
4646
47+
## Pre-receive hook timeouts
48+
49+
Pre-receive hooks in {% data variables.product.prodname_ghe_server %} have a fixed timeout budget of 5 seconds (shared across all hooks). This is intentional design to prevent resource exhaustion from long-running hooks and to prevent runaway scripts from blocking repository operations indefinitely.
50+
51+
All pre-receive hooks for a repository share a **cumulative timeout budget**:
52+
- If hook A takes 3 seconds, hook B gets 2 seconds remaining (from 5 second default)
53+
- If hook A times out at 5 seconds, hook B never executes
54+
55+
> [!IMPORTANT]
56+
> Pre-receive hook timeouts are handled differently from exit codes:
57+
> - **Exit codes**: Enforcement configuration is honored (non-enforced hooks don't block pushes)
58+
> - **Timeouts**: Push may fail regardless of enforcement configuration
59+
60+
### Timeout behavior
61+
62+
Scenario | Enforcement = Enabled | Enforcement = Disabled/Testing
63+
----------|----------------------|--------------------------------
64+
Exit code ≠ 0 | Push rejected | Push continues (warning only)
65+
Timeout exceeded | Push rejected | Warning + push may still fail
66+
4767
{% ifversion ghes > 3.16 %}
4868

4969
{% data reusables.repositories.push-rule-and-prereceive-hooks %}

0 commit comments

Comments
 (0)