opencode-mission-control icon indicating copy to clipboard operation
opencode-mission-control copied to clipboard

bug: plan merge fails when job has no git-tracked changes (e.g. writes only to gitignored paths)

Open nigel-dev opened this issue 9 months ago • 0 comments

Description

When a job in an orchestrated plan completes successfully but produces no git-tracked changes (e.g., it only writes files to a gitignored directory), the squash merge step fails with "nothing to commit, working tree clean." This blocks the entire pipeline — downstream dependent jobs never launch, and the plan enters a paused/failed state that cannot be retried.

Steps to Reproduce

  1. Create a plan with symlinkDirs: ["ai-docs"] where ai-docs/ is listed in .gitignore
  2. Have a review job whose only output is writing a findings file to ai-docs/review-findings.md (via the symlink)
  3. The review job completes successfully and calls mc_report(status: "completed")
  4. Plan attempts to squash-merge the job's branch into the integration branch
  5. Merge fails: Failed to commit squashed merge: nothing to commit, working tree clean
  6. Dependent job (e.g., fix job) never launches
  7. Retrying with mc_plan_approve(retry: "review-projects") hits the same failure

Expected Behavior

If a job completes successfully but has no git-tracked changes to merge, the plan should treat this as a successful no-op merge and proceed to launch dependent jobs. The job's work product (files written to symlinked/gitignored directories) is already available on disk — git merge is not the delivery mechanism in this case.

Actual Behavior

The plan fails at the merge step with "nothing to commit" and enters a paused state. Dependent jobs are permanently blocked. The only workaround is to launch the dependent job manually outside the plan.

Environment

  • OS: macOS (Apple Silicon)
  • tmux version: 3.5a
  • opencode version: 3.7.1
  • bun version: 1.3.6

Additional Context

This is a common pattern when using symlinkDirs for shared state between jobs. Review jobs write findings docs to a shared gitignored directory, and fix jobs read them. The symlink approach works perfectly for data sharing — the issue is purely in the merge step assuming every completed job must have commits.

Workaround used: Launched the dependent fix job as a standalone MC job (mc_launch) outside the plan, since the findings file was already on disk via the symlink.

Suggested fix options:

  1. Skip merge for empty branches — If diff between job branch and integration branch is empty, mark as "merged (no changes)" and proceed
  2. Allow allowEmptyMerge job option — Opt-in flag for jobs known to produce no git changes
  3. Auto-detect symlink-only jobs — If a job has symlinkDirs and no git changes, infer that its output was delivered via symlink

nigel-dev avatar Feb 17 '26 20:02 nigel-dev