Repository navigation
Run the clip-picking calls of a round at once - #26
Merged
Merged
Conversation
find_clips now plans its job (checks, transcript, budget) where it is called, and the loop makes every picker call the round asked for together, across videos and across the windows of a long one, up to ASSISTANT_CLIP_PICK_CONCURRENCY (4) at a time. One after another they were most of the wait when several videos were weighed. The budget is taken when a job is planned, so the calls of one round can't together overspend it. One video's provider failure is that call's error; the others' answers still stand. Spend is recorded under a lock, since the turn's running total is read and written back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V1geD2rbaPtRa9JcN8sZH8
davior
marked this pull request as ready for review
October 28, 2026 14:42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
#25 added a separate clip-picking pass, but its model calls ran one after another. That covered every window of a long video, and every video the assistant asked about in the same round. With several candidate videos, those calls were most of a request's wait.
What changes
find_clipsis split into plan and finish.plan_clipsdoes the checks, fetches the transcript and takes the budget, and returns aClipJobholding its prompts.finish_clip_jobsmakes the calls for any number of jobs on a thread pool and gives each job's answer back in order.find_clipson its own is plan plus finish, so the windows of a single long video also run at once.find_clipscall in a model reply, runs all their picker calls together, and answers every tool call in its original order. Other tools still run in place and in order, so a search earlier in the same reply is still seen.ASSISTANT_CLIP_PICK_CONCURRENCY(default 4) caps how many picker calls run at once. Each one is a request to the user's own provider, so this also sets how hard one request leans on their rate limit.ASSISTANT_MAX_CLIP_PICKS.read_transcript. The other videos' answers still stand, and only successful answers are cached.Testing
pytest -q: 723 passed. New tests:npm test && npm run build: 187 passed and the build succeeds (no frontend changes).Generated by Claude Code