Skip to content

feat(cli): add a governed, fail-closed --integrate command for reviewable parallel-branch integration (#228)#229

Merged
qwen-code-dev-bot merged 1 commit into
mainfrom
issue/228-selective-integration
Jul 23, 2026
Merged

feat(cli): add a governed, fail-closed --integrate command for reviewable parallel-branch integration (#228)#229
qwen-code-dev-bot merged 1 commit into
mainfrom
issue/228-selective-integration

Conversation

@qwen-code-dev-bot

Copy link
Copy Markdown
Owner

Summary

Adds an opt-in (--integrate) governed, fail-closed command that reviewably integrates a parallel agent's branch into the current branch, decomposed from roadmap #39 (isolated parallel agents).

Conflict prediction (#226) and isolation (#41, #50) let parallel agents work safely and foresee conflicts, but nothing performed the integration of a parallel agent's branch back into the target in a governed, reviewable way. This command does, preserving commit identity and failing closed.

Design

  • New src/selective-integration.ts: integrateBranch(workspace, source, { dryRun }) reuses predictMergeConflict (Parallel integration: predict whether a parallel agent's branch conflicts with the target before merging, redacted and fail-closed #226) to refuse a conflicting merge, builds a bounded (100 paths / 50 commits), redacted preview (changed paths + commit list), and otherwise performs a non-fast-forward merge (git merge --no-ff) that preserves the source's commit identity. It fails closed on a detached HEAD, a dirty tree, an unresolvable revision, a predicted conflict, or a failed merge.
  • src/index.ts: opt-in --integrate <source> with --integrate-dry-run (preview without merging), wired as a mode (JSON + text), exiting 0 on success and 2 on a usage/state error.

The integration never discards changes or auto-resolves conflicts, and the preview surfaces no file contents.

Testing

  • tests/unit/selective-integration.test.ts (8 tests): clean non-fast-forward integration with commit-identity preservation (two-parent merge commit, feature commit remains an ancestor), conflict refusal, fail-closed on dirty tree / unresolvable revision / detached HEAD, dry-run preview without merge, nothing-to-integrate, and formatting.
  • tests/integration/selective-integration.test.ts (4 tests): CLI integrates a clean branch (JSON) creating a merge commit, refuses a conflicting branch (exit 2, no merge), dry-run preview without merge (text), and exit 2 on unresolvable revision.

Gates: typecheck, build, unit (1639), integration (451 + desktop), smoke (51) all pass.

Closes #228

…able parallel-branch integration (#228)

Conflict prediction (#226) and isolation (#41, #50) let parallel agents work safely and foresee conflicts, but nothing performed the integration of a parallel agent's branch back into the target in a governed, reviewable way. Add an opt-in --integrate <source> [--integrate-dry-run] command that reuses conflict prediction to refuse a conflicting merge, shows a bounded/redacted preview (changed paths + commit list), and otherwise performs a non-fast-forward merge preserving the source's commit identity. It fails closed on a detached HEAD, dirty tree, unresolvable revision, predicted conflict, or failed merge, and never discards changes or auto-resolves conflicts.
@qwen-code-dev-bot

Copy link
Copy Markdown
Owner Author

E2E verification

  • Repository: qwen-code-dev-bot/oh-my-cli
  • Pull request: #229
  • Commit: fca06d46914a800d1810c628ca53749d25104df1
  • Evidence mode: terminal
  • Result: PASS
Scenario Command Exit Duration
integration npm run test:integration 0 29.317s
smoke npm run smoke 0 3.018s

E2E evidence

Full immutable report

@qwen-code-dev-bot
qwen-code-dev-bot merged commit c95c0ff into main Jul 23, 2026
2 checks passed
@qwen-code-dev-bot
qwen-code-dev-bot deleted the issue/228-selective-integration branch July 23, 2026 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant