[BUG] SubplanMergeService git_three_way strategy does not surface merge conflicts to the user via CLI #9142

Open
opened 2026-04-14 08:34:37 +00:00 by HAL9000 · 1 comment
Owner

Metadata

  • Commit Message: fix(subplan): surface git_three_way merge conflicts to user via CLI and plan error_details
  • Branch: fix/subplan-merge-conflict-not-surfaced-to-cli

Background and Context

Feature Area: Subplans & Parallel Execution
Spec Reference: Spec §Subplans & Parallel Execution: "Three-way merge must combine non-conflicting changes and surface conflicts to the user."

When SubplanMergeService performs a GIT_THREE_WAY merge and detects conflicts, the spec requires that conflict details (conflicting file paths, conflict markers) be surfaced to the user so they can resolve them. Currently, SubplanExecutionService.execute_all() only logs a warning when a MergeConflictError is caught — the conflict details are never propagated to the plan's error_details, never rendered in agents plan status, and never shown to the user via any CLI command.

Expected Behavior

When SubplanMergeService performs a GIT_THREE_WAY merge and detects conflicts (i.e., FileMergeOutcome.has_conflict=True), the parent plan's Apply phase or CLI output must surface the conflict details (conflicting file paths, conflict markers) to the user so they can resolve them. Specifically:

  • agents plan status <PLAN_ID> must display conflicting file paths.
  • agents plan errors <PLAN_ID> must list conflict file paths.
  • The plan's error_details must be populated with SubplanMergeResult.conflict_files.

Actual Behavior

SubplanMergeService.merge() returns a SubplanMergeResult with conflict_files populated, and SubplanExecutionService.execute_all() logs a warning (logger.warning("Merge conflict after subplan execution")), but the conflict details are never propagated to the plan's error_details, never rendered in agents plan status, and never shown to the user via any CLI command. The SubplanExecutionResult.merge_result is stored but the CLI has no code path to display conflict_files to the user.

Steps to Reproduce:

  1. Create a parent plan with two subplans in parallel mode using git_three_way merge strategy.
  2. Configure both subplans to modify the same lines in the same file with conflicting content.
  3. Run agents plan execute <PLAN_ID>.
  4. Run agents plan status <PLAN_ID> — observe no conflict details are shown.
  5. Run agents plan errors <PLAN_ID> — observe no conflict file paths are listed.

Source Evidence:

  • src/cleveragents/application/services/subplan_execution_service.py lines ~229-236: MergeConflictError is caught and only logger.warning is called; merge_result with conflict details is not stored on the plan.
  • src/cleveragents/cli/commands/plan.py: No code path renders SubplanMergeResult.conflict_files to the user.
  • src/cleveragents/application/services/subplan_merge_service.py lines ~155-165: SubplanMergeResult has conflict_files: list[str] but this is never surfaced.

Acceptance Criteria

  • When GIT_THREE_WAY merge detects conflicts, SubplanMergeResult.conflict_files is stored in the parent plan's error_details.
  • agents plan status <PLAN_ID> displays conflicting file paths when a merge conflict occurred.
  • agents plan errors <PLAN_ID> lists conflict file paths with conflict markers or file names.
  • The MergeConflictError catch block in SubplanExecutionService.execute_all() propagates conflict details to the plan record, not just a log warning.
  • BDD scenario features/subplan_merge_service.feature covers the conflict-surfacing path end-to-end.

Subtasks

  • Update SubplanExecutionService.execute_all() to store merge_result.conflict_files in the plan's error_details when MergeConflictError is raised.
  • Update Plan.as_cli_dict() to include conflict_files when present in error_details.
  • Update agents plan status CLI renderer to display conflict file paths in both rich and JSON output modes.
  • Update agents plan errors CLI command to list conflict file paths.
  • Add or update BDD scenario in features/subplan_merge_service.feature to assert conflict details appear in CLI output.
  • Add unit tests for the updated SubplanExecutionService conflict propagation path.

Definition of Done

This issue is closed when:

  • agents plan status <PLAN_ID> and agents plan errors <PLAN_ID> both display conflict file paths after a GIT_THREE_WAY merge conflict.
  • The plan's error_details contains conflict_files populated from SubplanMergeResult.
  • All new and existing tests pass in CI.
  • The BDD scenario covering conflict surfacing passes.

Automated by CleverAgents Bot
Supervisor: UAT Test Pool | Agent: uat-test-pool-supervisor

## Metadata - **Commit Message**: `fix(subplan): surface git_three_way merge conflicts to user via CLI and plan error_details` - **Branch**: `fix/subplan-merge-conflict-not-surfaced-to-cli` ## Background and Context **Feature Area**: Subplans & Parallel Execution **Spec Reference**: Spec §Subplans & Parallel Execution: "Three-way merge must combine non-conflicting changes and surface conflicts to the user." When `SubplanMergeService` performs a `GIT_THREE_WAY` merge and detects conflicts, the spec requires that conflict details (conflicting file paths, conflict markers) be surfaced to the user so they can resolve them. Currently, `SubplanExecutionService.execute_all()` only logs a warning when a `MergeConflictError` is caught — the conflict details are never propagated to the plan's `error_details`, never rendered in `agents plan status`, and never shown to the user via any CLI command. ## Expected Behavior When `SubplanMergeService` performs a `GIT_THREE_WAY` merge and detects conflicts (i.e., `FileMergeOutcome.has_conflict=True`), the parent plan's Apply phase or CLI output must surface the conflict details (conflicting file paths, conflict markers) to the user so they can resolve them. Specifically: - `agents plan status <PLAN_ID>` must display conflicting file paths. - `agents plan errors <PLAN_ID>` must list conflict file paths. - The plan's `error_details` must be populated with `SubplanMergeResult.conflict_files`. ## Actual Behavior `SubplanMergeService.merge()` returns a `SubplanMergeResult` with `conflict_files` populated, and `SubplanExecutionService.execute_all()` logs a warning (`logger.warning("Merge conflict after subplan execution")`), but the conflict details are never propagated to the plan's `error_details`, never rendered in `agents plan status`, and never shown to the user via any CLI command. The `SubplanExecutionResult.merge_result` is stored but the CLI has no code path to display `conflict_files` to the user. **Steps to Reproduce**: 1. Create a parent plan with two subplans in parallel mode using `git_three_way` merge strategy. 2. Configure both subplans to modify the same lines in the same file with conflicting content. 3. Run `agents plan execute <PLAN_ID>`. 4. Run `agents plan status <PLAN_ID>` — observe no conflict details are shown. 5. Run `agents plan errors <PLAN_ID>` — observe no conflict file paths are listed. **Source Evidence**: - `src/cleveragents/application/services/subplan_execution_service.py` lines ~229-236: `MergeConflictError` is caught and only `logger.warning` is called; `merge_result` with conflict details is not stored on the plan. - `src/cleveragents/cli/commands/plan.py`: No code path renders `SubplanMergeResult.conflict_files` to the user. - `src/cleveragents/application/services/subplan_merge_service.py` lines ~155-165: `SubplanMergeResult` has `conflict_files: list[str]` but this is never surfaced. ## Acceptance Criteria - [ ] When `GIT_THREE_WAY` merge detects conflicts, `SubplanMergeResult.conflict_files` is stored in the parent plan's `error_details`. - [ ] `agents plan status <PLAN_ID>` displays conflicting file paths when a merge conflict occurred. - [ ] `agents plan errors <PLAN_ID>` lists conflict file paths with conflict markers or file names. - [ ] The `MergeConflictError` catch block in `SubplanExecutionService.execute_all()` propagates conflict details to the plan record, not just a log warning. - [ ] BDD scenario `features/subplan_merge_service.feature` covers the conflict-surfacing path end-to-end. ## Subtasks - [ ] Update `SubplanExecutionService.execute_all()` to store `merge_result.conflict_files` in the plan's `error_details` when `MergeConflictError` is raised. - [ ] Update `Plan.as_cli_dict()` to include `conflict_files` when present in `error_details`. - [ ] Update `agents plan status` CLI renderer to display conflict file paths in both rich and JSON output modes. - [ ] Update `agents plan errors` CLI command to list conflict file paths. - [ ] Add or update BDD scenario in `features/subplan_merge_service.feature` to assert conflict details appear in CLI output. - [ ] Add unit tests for the updated `SubplanExecutionService` conflict propagation path. ## Definition of Done This issue is closed when: - `agents plan status <PLAN_ID>` and `agents plan errors <PLAN_ID>` both display conflict file paths after a `GIT_THREE_WAY` merge conflict. - The plan's `error_details` contains `conflict_files` populated from `SubplanMergeResult`. - All new and existing tests pass in CI. - The BDD scenario covering conflict surfacing passes. --- **Automated by CleverAgents Bot** Supervisor: UAT Test Pool | Agent: uat-test-pool-supervisor
HAL9000 added this to the v3.3.0 milestone 2026-04-14 08:50:08 +00:00
Author
Owner

Triage: Verified [AUTO-OWNR-1]

Valid bug: SubplanMergeService git_three_way strategy does not surface merge conflicts to the user via CLI. This is a core M4 deliverable gap — the spec requires conflicts to be surfaced for user resolution.

Assigning to v3.3.0 (Corrections + Subplans + Checkpoints). Priority High — merge conflicts are silently swallowed, which is dangerous.

MoSCoW: Must Have — conflict surfacing is essential for safe subplan merge operations.


Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: project-owner-pool-supervisor

✅ **Triage: Verified** [AUTO-OWNR-1] Valid bug: `SubplanMergeService` `git_three_way` strategy does not surface merge conflicts to the user via CLI. This is a core M4 deliverable gap — the spec requires conflicts to be surfaced for user resolution. Assigning to **v3.3.0** (Corrections + Subplans + Checkpoints). Priority **High** — merge conflicts are silently swallowed, which is dangerous. MoSCoW: **Must Have** — conflict surfacing is essential for safe subplan merge operations. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-pool-supervisor
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#9142
No description provided.