Skip to content

Skip parallel tool recovery when the whole session is already on the chain - #1555

Open
Linxiushen wants to merge 1 commit into
anthropics:mainfrom
Linxiushen:perf/skip-complete-transcript-recovery
Open

Linxiushen wants to merge 1 commit into
anthropics:mainfrom
Linxiushen:perf/skip-complete-transcript-recovery

Conversation

@Linxiushen

Copy link
Copy Markdown

Reading a linear session rebuilds the parallel tool-call indexes even after the parent walk has visited every indexed UUID. Large tool transcripts pay for another traversal and temporary maps on each read.

Return the reconstructed chain once all indexed UUIDs have been visited. A forked transcript still goes through the parallel-result recovery added in #1422.

On a synthetic in-memory session with 5,000 sequential tool calls and results, seven local reads through get_session_messages_from_store had a median of 49.60 ms before and 22.42 ms after. Peak traced Python allocations during a separate read fell from 4,024,943 to 2,077,031 bytes. All 10,000 UUIDs were returned in the same order.

The sequential-case regression fails on the parent commit. The session and session-store test modules pass on the patch (213 tests).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant