[PR #7518] fix(opencode): speed up project resolution with single root commit query #12424

Open
opened 2026-02-16 18:17:20 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/7518

State: open
Merged: No


What does this PR do?

Use --max-count=1 to fetch only the first root commit during ID resolution rather than fetching all of them. This is significantly faster on repos with many root commits/orphan branches. In my testing on a huge repo with 170 orphaned branches, the execution time went from 10s to 1.5s on a cold cache, and 3.5s to 1.2s on a warm cache.

How did you verify your code works?

Tested in a repo with many orphan branches, and a repo with one root branch.

The generated ID for the repo with many orphan branches was different from the previous code, so this is not backwards compatible, although the cached ID should stay the same if it was stored. I'm not sure what if any impact this has on the rest of the system though.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/7518 **State:** open **Merged:** No --- ### What does this PR do? Use `--max-count=1` to fetch only the first root commit during ID resolution rather than fetching all of them. This is significantly faster on repos with many root commits/orphan branches. In my testing on a huge repo with 170 orphaned branches, the execution time went from 10s to 1.5s on a cold cache, and 3.5s to 1.2s on a warm cache. ### How did you verify your code works? Tested in a repo with many orphan branches, and a repo with one root branch. The generated ID for the repo with many orphan branches was different from the previous code, so this is _not_ backwards compatible, although the cached ID should stay the same if it was stored. I'm not sure what if any impact this has on the rest of the system though.
yindo added the pull-request label 2026-02-16 18:17:20 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12424