Skip to content

refactor(opencode): parallelize git snapshot operations on finish-step#16103

Open
robertkohahimn wants to merge 3 commits intoanomalyco:devfrom
robertkohahimn:robertkohahimn/perf-snapshot-parallelize
Open

refactor(opencode): parallelize git snapshot operations on finish-step#16103
robertkohahimn wants to merge 3 commits intoanomalyco:devfrom
robertkohahimn:robertkohahimn/perf-snapshot-parallelize

Conversation

@robertkohahimn
Copy link

@robertkohahimn robertkohahimn commented Mar 5, 2026

Issue for this PR

Closes #12437

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

On every LLM finish-step, the processor called Snapshot.track() then Snapshot.patch() sequentially. Both called git add . internally, so the worktree was staged twice with no files changing in between.

This PR adds trackAndPatch() which calls git add . once, then runs git write-tree and git diff --name-only concurrently via Promise.all. The standalone track() and patch() functions are unchanged for other callers.

How did you verify your code works?

  • Read both call sites in processor.ts to confirm trackAndPatch produces the same hash and patch data as the previous sequential calls
  • Verified patch() and track() remain unchanged for other callers (revert, debug CLI)
  • Confirmed no type errors in the changed files

Screenshots / recordings

N/A — no UI changes.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Eliminate redundant git add and run write-tree + diff concurrently
via Promise.all in new trackAndPatch() method.

Fixes anomalyco#12437
@github-actions github-actions bot added needs:compliance This means the issue will auto-close after 2 hours. needs:title labels Mar 5, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

Hey! Your PR title perf(opencode): parallelize git snapshot operations on finish-step 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.

@robertkohahimn robertkohahimn changed the title perf(opencode): parallelize git snapshot operations on finish-step refactor(opencode): parallelize git snapshot operations on finish-step Mar 5, 2026
@github-actions github-actions bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Mar 5, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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.

Work very slowly in large git repos(2GB+)

1 participant