opencode icon indicating copy to clipboard operation
opencode copied to clipboard

fix(opencode): speed up project resolution with single root commit query

Open rygwdn opened this issue 5 days ago • 3 comments

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.

rygwdn avatar Jan 09 '26 19:01 rygwdn

Hey! Your PR title perf: speed up project resolution with single root commit query doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

github-actions[bot] avatar Jan 09 '26 19:01 github-actions[bot]

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

github-actions[bot] avatar Jan 09 '26 19:01 github-actions[bot]

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

github-actions[bot] avatar Jan 09 '26 19:01 github-actions[bot]