-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Parent Issue
Sub-issue of #344 (Leverage Additional SDK v0.2.25 Capabilities)
Feature Type
SDK integration (Agent SDK)
Problem or Need
Batch isolation currently uses persistSession: true + continue: true + explicit /clear command between scenarios (session-batching.ts:563-608). This adds a round-trip per scenario in a batch. The current approach is battle-tested and provides ~80% overhead reduction vs individual sessions.
Proposed Solution
Evaluate SDK v0.2.25 forkSession option as an alternative to /clear + continue for batch isolation.
Potential benefits:
- Eliminate the
/clearquery round-trip, reducing per-scenario overhead - Fork semantics may provide better isolation than
/clear
Key questions requiring investigation:
- Does
forkSessionfork the subprocess or the conversation state? - How does it interact with
enableFileCheckpointingandrewindFiles()? - What are the performance characteristics vs
/clear? - Does forking preserve or reset tool state?
Files Affected
src/stages/3-execution/session-batching.ts— executeBatch, sendClearCommand, buildScenarioQueryInputsrc/stages/3-execution/sdk-client.ts— QueryOptions
Risk Assessment
High risk — Session batching is a core optimization (80% overhead reduction). Any regression here impacts all batch execution. The interaction between forkSession, persistSession, continue, and file checkpointing needs careful testing.
Recommended Approach
- Create experimental branch for
forkSessionevaluation - Benchmark against current
/clearapproach (latency, memory, isolation quality) - Test interaction with file checkpointing
- If results are positive, implement as opt-in configuration option
- Only consider deprecating
/clearapproach after extensive production validation
Priority Rationale
Highest potential impact but also highest risk. Current approach works well and is battle-tested. Should be thoroughly evaluated before any production adoption.
🤖 Created with Claude Code