Skip to content

[Feature]: Use interrupt() method as graceful timeout alternative #347

@sjnims

Description

@sjnims

Parent Issue

Sub-issue of #344 (Leverage Additional SDK v0.2.25 Capabilities)

Feature Type

SDK integration (Agent SDK)

Problem or Need

Scenario timeouts currently use AbortController with setTimeout (agent-executor.ts:224-225, session-batching.ts:727). While functional, AbortController force-kills execution rather than allowing the agent to stop gracefully and potentially produce a partial result.

Proposed Solution

Use the SDK v0.2.25 interrupt() method as an alternative to AbortController for scenario execution timeouts.

Key considerations:

  • interrupt() signals the agent to stop gracefully, potentially allowing a partial result message
  • Must verify that interrupted queries still produce SDKResultMessage for metrics extraction (extractResultMetrics at agent-executor.ts:390)
  • Implement as alternative to AbortController with configuration toggle initially
  • Integrate with existing retry logic in session-batching.ts

Files Affected

  • src/stages/3-execution/agent-executor.ts — prepareExecutionContext, executeScenario, executeScenarioWithCheckpoint
  • src/stages/3-execution/session-batching.ts — executeScenarioWithRetry
  • src/stages/3-execution/sdk-client.ts — QueryObject interface

Risk Assessment

Medium risk — Need to verify interrupt() still triggers the for await loop to complete and produce an SDKResultMessage. Affects timeout handling which is a core reliability feature.

Testing Requirements

  • Unit tests for interrupt-based timeout handling
  • Integration test with real SDK to verify SDKResultMessage is produced after interrupt
  • Verify retry logic still works correctly with interrupt semantics

Priority Rationale

High value for timeout handling semantics. Second-highest priority per #344 analysis.


🤖 Created with Claude Code

Metadata

Metadata

Assignees

Labels

effort:medium1-4 hoursenhancementNew feature or requestperformancePerformance and efficiency improvementspriority:highImportant but not blockingsdk:agentClaude Agent SDK usage (Stage 3)stage:executionStage 3: Agent SDK execution with tool capturestatus:analyzedIssue has been analyzed by Claude

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions