Problem
SessionEnd hooks currently run sequentially without enforcement of maximum execution time. This architecture creates a critical bottleneck: if any hook in the chain hangs (due to slow stdin, unresponsive APIs, or large transcript processing), all subsequent hooks are blocked indefinitely.
This is particularly problematic for developers adding new hooks to the end of the chain. A single misbehaving hook earlier in the sequence can prevent new logic from ever executing, making the system unreliable and difficult to debug.
Suggested Fix
Implement a hard timeout safety net for each SessionEnd hook using setTimeout with a process.exit(0) fallback, ensuring clearTimeout is called on normal exit paths.
Recommended timeouts:
- 10s for file-only hooks
- 15s for API-calling hooks
- 30s for inference hooks
Problem
SessionEnd hooks currently run sequentially without enforcement of maximum execution time. This architecture creates a critical bottleneck: if any hook in the chain hangs (due to slow stdin, unresponsive APIs, or large transcript processing), all subsequent hooks are blocked indefinitely.
This is particularly problematic for developers adding new hooks to the end of the chain. A single misbehaving hook earlier in the sequence can prevent new logic from ever executing, making the system unreliable and difficult to debug.
Suggested Fix
Implement a hard timeout safety net for each SessionEnd hook using
setTimeoutwith aprocess.exit(0)fallback, ensuringclearTimeoutis called on normal exit paths.Recommended timeouts: