feat: feat: enhance job execution with agent selection and timeout (#21)#26
Merged
feat: feat: enhance job execution with agent selection and timeout (#21)#26
Conversation
added 2 commits
April 3, 2026 17:44
…ection for job execution This commit enhances the job execution system with timeout control and improved agent selection capabilities as described in Issue #21. ## Changes ### Job Structure Enhancement - Added `Timeout time.Duration` field to Job struct to support job-level timeout configuration - Added `Timeout` field to JobSummary for API consistency - Updated `newJob()` function to accept timeout parameter ### API Changes - Modified `Manager.Submit()` to accept timeout parameter (0 means no timeout) - Updated `ExecuteJob()` to use `context.WithTimeout` for timeout enforcement - Gateway API now accepts optional `timeout` parameter (in seconds) for job submission ### Gateway Updates - Updated `handleJobsAPI` POST handler to accept timeout in request body - Updated `handleJobSubmit` JSON-RPC handler to accept timeout parameter - Timeout is converted from seconds to time.Duration internally ### Testing - Added comprehensive timeout tests: - `TestExecuteJob_Timeout`: Verifies jobs fail correctly when timeout is exceeded - `TestExecuteJob_NoTimeout`: Confirms jobs without timeout complete successfully - `TestJobTimeoutInSummary`: Validates timeout is included in job summaries - `TestJobTimeoutInClone`: Ensures timeout is preserved when cloning jobs - Updated all existing tests to work with new API signature - All tests pass successfully ## Behavior When a job timeout is set: - A context with timeout is created for the job execution - If the executor doesn't complete within the specified timeout, the job is marked as failed - The error message clearly indicates the timeout duration - Jobs with timeout=0 run without time limit (backward compatible) ## Backward Compatibility The changes maintain backward compatibility: - Existing code can pass 0 as timeout to disable timeout enforcement - Default agent selection via AgentName field remains unchanged - All existing tests continue to pass
…lection and timeout Implemented by autoresearch with score 9.0/10 after 3 iterations. Closes #21
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.
Summary
Test plan
Closes #21