perf: speed up large session forks - #11075
Conversation
Code Review SummaryStatus: 1 Resolved, 1 Suggestion Remaining | Recommendation: Merge Overview
Issue Details (click to expand)RESOLVED
SUGGESTION
Other Observations (not blocking)
Detached completed tasks get Test coverage is thorough: The updated Files Reviewed (11 files)
Fix these issues in Kilo Cloud Reviewed by claude-4.6-sonnet-20260217 · 758,940 tokens Review guidance: REVIEW.md from base branch |
1eed36e to
fd566bb
Compare
perf: speed up large session forks
Problem
Forking a session previously copied every referenced subagent session recursively. A large parent could therefore expand into hundreds of child sessions and tens of thousands of message and part writes before Agent Manager could open the new tab. In the profiled case, the visible parent referenced 194 child sessions and took 12.66 seconds to fork.
The fork does not need those child sessions as live execution state. Their completed outcomes are already embedded in the parent task results, and copied children cannot continue running work from the source session.
Behavior
The fork now copies only the parent transcript. Task calls become detached historical results:
Completed task cards also start collapsed and hydrate child details only when expanded. Existing source sessions still allow opening their historical child transcripts.
Why This Is Faster
The change removes four sources of work from the fork path:
For the profiled large session, click-to-tab time dropped from 12.66 seconds to approximately 1.5 seconds.
Product Constraint
A fork no longer contains navigable or resumable copies of historical child sessions. It retains their final outcomes, while detailed child history remains available from the source session. This intentionally treats a fork as a continuation of the parent conversation rather than a duplicate of prior subagent execution state.