fix(curiocity): add command evaluator timeout - #338
Open
atomicdjt wants to merge 2 commits into
Open
Conversation
Signed-off-by: David Turner <davidelsey9513@gmail.com>
Signed-off-by: David Turner <davidelsey9513@gmail.com>
Contributor
Author
|
@coderabbitai review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #302
Summary
commandevaluator;timeoutSecoption with a 60-second default;pass: falsefailure semantics.Root cause
commandinvokedctx.exec(..., { shell: true })without a timeout, so a hanging build, test, or lint command could block a trial indefinitely. The siblingexternalevaluator provides the repository precedent for timeout configuration and Execa timeout reporting.Behavior
timeoutSecmust be positive and defaults to 60 seconds. A timeout is returned as a normal failedEvalResultwith details identifying the configured duration; it does not throw, preserving the command evaluator's existing failure contract. The evaluator entry's configuredgatevalue remains owned by the pipeline and is applied there.With shell: true, terminating the shell alone does not reliably terminate descendants that retain inherited output handles. Hosted Ubuntu CI exposed this after the initial Execa-only timeout implementation continued waiting on a nested child. The final implementation therefore creates a detached POSIX process group and terminates that group at the configured deadline; on Windows it uses taskkill /t /f. Execa retains a short reporting grace period after tree termination.
Tests
npm run lint— passnpm run build— passgit diff --check— passnpm teston the local Windows host — 414 pass, 23 pre-existing platform-sensitive failures in PTY/path tests and the POSIX-only diagnostic command; all new timeout tests passnpm ci,npm run lint,npm run build,npm run test) is the hosted verification gateThe focused regression coverage proves real bounded execution, default and fractional timeout handling, invalid timeout rejection, and unchanged success/ordinary nonzero-exit behavior.
Compatibility and scope
Existing command definitions without
timeoutSeccontinue to use the 60-second default. Tiny positive values are clamped to a 1 ms Execa deadline because Execa treats a zero timeout as disabled. The external evaluator and unrelated Curiocity behavior are unchanged.