-
Notifications
You must be signed in to change notification settings - Fork 6
Add OpenCode driver + Empty Git Repo behavior #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Added OpenCodeExecutor with run command support - Added factory pattern for agent type selection - Added CLI flags for --agent-type and --opencode-model - Added configuration for OpenCode model and server URL - Added comprehensive test coverage - Updated telemetry with AgentTypeOpenCode constant Co-Authored-By: MiniMax M2.1 <noreply@minimax.io>
- Fix unexported field access in test by using Path() method - Add EnsureMainBranch() to handle empty repos by creating main branch with initial commit - Fix MergeToMain() to handle unrelated histories error by using reset --hard strategy - Add comprehensive tests for empty repo scenarios - Update Create() to check for empty repo before calling EnsureMainBranch
- Add SpanGitEnsureMain and SpanGitWorktreeMerge span constants - Add StartGitSpan helper function for git operations - Add context parameter to EnsureMainBranch and MergeToMain - Track repo.had_commits and task.id attributes for empty repo detection
PR #4 Review: OpenCode Agent SupportThanks so much for putting this together @JoshuaSkootsky SummaryThis PR adds OpenCode agent support with a new executor factory pattern. However, there are several merge conflicts and architectural inconsistencies that need to be resolved. Key Changes in PR
Merge Conflicts Identified1. MergeToMain Signature Change
|
I saw Drover and thought to add OpenCode as an alternative to Claude Code
Testing out the OpenCode I ran into some bugs with empty git repos that I wanted to add to Drover
[edit] possibly you good people at Drover handled these issues over the weekend!
Add Support for Empty Git Repositories with Telemetry
Summary
Enable Drover to work with empty Git repositories by automatically initializing a main branch when needed, and adds comprehensive telemetry to track empty repo scenarios for observability.
Problem
Drover previously failed when encountering empty Git repositories with the error:
fatal: refusing to merge unrelated histories
No visibility into how frequently empty repos were encountered
Workflow would break on first run against new/empty repositories
Solution
Added EnsureMainBranch() method that detects empty repos and creates an initial commit on the target branch
Modified MergeToMain() to use git reset --hard strategy when encountering unrelated histories
Both operations are now idempotent and safe to call multiple times
Added SpanGitEnsureMain = "drover.git.ensure_main" for branch initialization tracking
Added SpanGitWorktreeMerge = "drover.git.worktree_merge" for merge operations
Added StartGitSpan() helper function for consistent git operation tracing
Updated EnsureMainBranch(ctx context.Context) and MergeToMain(ctx context.Context, taskID string) to accept context
Updated all 7 callers across workflow orchestrators to pass context through
Enables full distributed tracing from workflow → git operations
Key Changes
Testing
✅ All 15 git package tests pass
✅ 9/9 core orchestrator tests pass (6 DBOS tests require PostgreSQL)
✅ Verified empty repo workflow: git init → EnsureMainBranch() → MergeToMain() succeeds
✅ Verified non-empty repo workflow remains unchanged
Impact
Operational: Drover now works seamlessly with both empty and populated repositories
Observability: You can now query metrics on empty repo frequency:
-- Example: % of merges that encountered empty repos
SELECT (SUM(CASE WHEN attrs['repo.had_commits'] = 'false' THEN 1 ELSE 0 END) * 100.0 / COUNT(*))
FROM spans WHERE name = 'drover.git.worktree_merge'
Debugging: Full trace visibility into git operations with error correlation