timeout-test
Test timeout prevention mechanisms by running processes for specified durations to verify system stability and prevent execution failures.
Instructions
Test timeout prevention by running for a specified duration
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| duration | Yes | Duration in milliseconds (minimum 10ms) |
Input Schema (JSON Schema)
{
"properties": {
"duration": {
"description": "Duration in milliseconds (minimum 10ms)",
"minimum": 10,
"type": "number"
}
},
"required": [
"duration"
],
"type": "object"
}
Implementation Reference
- src/tools/timeout-test.tool.ts:16-37 (handler)The execute handler function implements the timeout test by progressively delaying execution with progress updates, simulating a long-running task to test timeout handling.execute: async (args, onProgress) => { const duration = args.duration as number; const steps = Math.ceil(duration / 5000); // Progress every 5 seconds const stepDuration = duration / steps; const startTime = Date.now(); const results: string[] = []; results.push(`Starting timeout test for ${duration}ms (${duration / 1000}s)`); for (let i = 1; i <= steps; i++) { await new Promise(resolve => setTimeout(resolve, stepDuration)); const elapsed = Date.now() - startTime; results.push(`Step ${i}/${steps} completed - Elapsed: ${Math.round(elapsed / 1000)}s`); } const totalElapsed = Date.now() - startTime; results.push(`\nTimeout test completed successfully!`); results.push(`Target duration: ${duration}ms`); results.push(`Actual duration: ${totalElapsed}ms`); return results.join('\n'); },
- src/tools/timeout-test.tool.ts:4-6 (schema)Zod input schema for the tool, validating the 'duration' parameter as a number with minimum 10ms.const timeoutTestArgsSchema = z.object({ duration: z.number().min(10).describe('Duration in milliseconds (minimum 10ms)'), });
- src/tools/index.ts:11-21 (registration)The timeoutTestTool is registered by being pushed into the central toolRegistry alongside other tools.toolRegistry.push( askCodexTool, batchCodexTool, // reviewCodexTool, pingTool, helpTool, versionTool, brainstormTool, fetchChunkTool, timeoutTestTool );
- src/tools/index.ts:9-9 (registration)Import of the timeoutTestTool definition prior to registration.import { timeoutTestTool } from './timeout-test.tool.js';