[BUG] Subplan merge conflicts detected but never surfaced to user for resolution (v3.3.0 Deliverable #6 missing) #9160

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

Metadata

  • Commit Message: feat(subplan): surface merge conflicts to user for resolution via CLI/TUI
  • Branch: feat/subplan-merge-conflict-user-surfacing

Background and Context

The v3.3.0 milestone specification (docs/specification.md line 46870) defines Deliverable #6:

| 6 | Merge conflicts surfaced to user for resolution | §Merge Strategies — Conflict Resolution | Conflicting changes produce CONFLICT markers; user prompted |

The current implementation detects merge conflicts and stores them in SubplanMergeResult.conflict_files and FileMergeOutcome.has_conflict, but there is no mechanism to surface these conflicts to the user via the CLI or TUI.

Current Behavior

When parallel subplans produce conflicting changes to the same file:

  1. SubplanMergeService.merge() (src/cleveragents/application/services/subplan_merge_service.py) detects conflicts and populates SubplanMergeResult.conflict_files.
  2. SubplanExecutionService.execute_all() (src/cleveragents/application/services/subplan_execution_service.py) logs a warning: "Merge conflict after subplan execution" and sets all_succeeded = False.
  3. PlanExecutor._apply_subplan_results_to_plan() (src/cleveragents/application/services/plan_executor.py) stores failed_subplan_ids in plan.error_details but does NOT surface conflict details.
  4. The CLI (src/cleveragents/cli/commands/) has no code to display conflict markers or prompt the user for resolution.
  5. The TUI has no conflict resolution UI.

The merged file content with CONFLICT markers (from git merge-file) is stored in FileMergeOutcome.content but is never written to disk or shown to the user.

Expected Behavior

Per spec Deliverable #6:

  • When subplan merge produces conflicts, the conflicting file(s) with CONFLICT markers should be written to the workspace so the user can see and resolve them.
  • The user should be prompted (via CLI output or TUI notification) that conflicts exist and need resolution.
  • The plan should enter a state that allows the user to resolve conflicts before proceeding.

Acceptance Criteria

  • When SubplanMergeResult.conflict_files is non-empty, the merged content (with CONFLICT markers) is written to the workspace
  • The CLI displays a clear message listing conflicting files and prompting the user for resolution
  • The TUI shows a notification or panel for conflict resolution
  • The plan enters a CONSTRAINED or similar state when conflicts are unresolved
  • Tests (Behave): Add scenarios verifying conflict surfacing behavior
  • Tests (Behave): Verify user is prompted when conflicts exist
  • nox -s unit_tests passes

Supporting Information

  • Spec reference: docs/specification.md line 46870 (v3.3.0 Deliverable #6)
  • Conflict detection: src/cleveragents/application/services/subplan_merge_service.py (SubplanMergeService.merge(), _git_three_way())
  • Conflict stored but not surfaced: src/cleveragents/application/services/subplan_execution_service.py (execute_all() method)
  • No CLI surfacing: src/cleveragents/cli/commands/ (no conflict-related code found)
  • GitMergeStrategy.merge() in src/cleveragents/infrastructure/sandbox/merge.py produces content with CONFLICT markers when has_conflicts=True

Subtasks

  • Add conflict surfacing logic to PlanExecutor._apply_subplan_results_to_plan() — write conflicted files to workspace
  • Add CLI output in plan execute/apply commands to display conflict files and prompt user
  • Add TUI notification for merge conflicts
  • Define plan state transition for unresolved conflicts (e.g., CONSTRAINED)
  • Tests (Behave): Add scenarios for conflict surfacing
  • Tests (Behave): Verify user is prompted when conflicts exist
  • Run nox -s unit_tests, fix any failures
  • Verify coverage ≥97% via nox -s coverage_report

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.

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

## Metadata - **Commit Message**: `feat(subplan): surface merge conflicts to user for resolution via CLI/TUI` - **Branch**: `feat/subplan-merge-conflict-user-surfacing` ## Background and Context The v3.3.0 milestone specification (`docs/specification.md` line 46870) defines Deliverable #6: > | 6 | Merge conflicts surfaced to user for resolution | §Merge Strategies — Conflict Resolution | Conflicting changes produce `CONFLICT` markers; user prompted | The current implementation detects merge conflicts and stores them in `SubplanMergeResult.conflict_files` and `FileMergeOutcome.has_conflict`, but there is **no mechanism to surface these conflicts to the user** via the CLI or TUI. ## Current Behavior When parallel subplans produce conflicting changes to the same file: 1. `SubplanMergeService.merge()` (`src/cleveragents/application/services/subplan_merge_service.py`) detects conflicts and populates `SubplanMergeResult.conflict_files`. 2. `SubplanExecutionService.execute_all()` (`src/cleveragents/application/services/subplan_execution_service.py`) logs a warning: `"Merge conflict after subplan execution"` and sets `all_succeeded = False`. 3. `PlanExecutor._apply_subplan_results_to_plan()` (`src/cleveragents/application/services/plan_executor.py`) stores `failed_subplan_ids` in `plan.error_details` but does NOT surface conflict details. 4. The CLI (`src/cleveragents/cli/commands/`) has no code to display conflict markers or prompt the user for resolution. 5. The TUI has no conflict resolution UI. The merged file content with `CONFLICT` markers (from `git merge-file`) is stored in `FileMergeOutcome.content` but is never written to disk or shown to the user. ## Expected Behavior Per spec Deliverable #6: - When subplan merge produces conflicts, the conflicting file(s) with `CONFLICT` markers should be written to the workspace so the user can see and resolve them. - The user should be prompted (via CLI output or TUI notification) that conflicts exist and need resolution. - The plan should enter a state that allows the user to resolve conflicts before proceeding. ## Acceptance Criteria - [ ] When `SubplanMergeResult.conflict_files` is non-empty, the merged content (with `CONFLICT` markers) is written to the workspace - [ ] The CLI displays a clear message listing conflicting files and prompting the user for resolution - [ ] The TUI shows a notification or panel for conflict resolution - [ ] The plan enters a `CONSTRAINED` or similar state when conflicts are unresolved - [ ] Tests (Behave): Add scenarios verifying conflict surfacing behavior - [ ] Tests (Behave): Verify user is prompted when conflicts exist - [ ] `nox -s unit_tests` passes ## Supporting Information - Spec reference: `docs/specification.md` line 46870 (v3.3.0 Deliverable #6) - Conflict detection: `src/cleveragents/application/services/subplan_merge_service.py` (`SubplanMergeService.merge()`, `_git_three_way()`) - Conflict stored but not surfaced: `src/cleveragents/application/services/subplan_execution_service.py` (`execute_all()` method) - No CLI surfacing: `src/cleveragents/cli/commands/` (no conflict-related code found) - `GitMergeStrategy.merge()` in `src/cleveragents/infrastructure/sandbox/merge.py` produces content with `CONFLICT` markers when `has_conflicts=True` ## Subtasks - [ ] Add conflict surfacing logic to `PlanExecutor._apply_subplan_results_to_plan()` — write conflicted files to workspace - [ ] Add CLI output in plan execute/apply commands to display conflict files and prompt user - [ ] Add TUI notification for merge conflicts - [ ] Define plan state transition for unresolved conflicts (e.g., `CONSTRAINED`) - [ ] Tests (Behave): Add scenarios for conflict surfacing - [ ] Tests (Behave): Verify user is prompted when conflicts exist - [ ] Run `nox -s unit_tests`, fix any failures - [ ] Verify coverage ≥97% via `nox -s coverage_report` ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. --- **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 09:05:06 +00:00
Author
Owner

Triage: Verified [AUTO-OWNR-1]

Valid bug: Subplan merge conflicts are detected but never surfaced to the user for resolution — this is v3.3.0 Deliverable #6 (three-way merge conflicts surfaced to user) which is missing. This is a core M4 deliverable gap.

Assigning to v3.3.0 (Corrections + Subplans + Checkpoints). Priority Medium — conflicts are detected but silently swallowed.

MoSCoW: Should Have — conflict surfacing is important for user control over merge outcomes.


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

✅ **Triage: Verified** [AUTO-OWNR-1] Valid bug: Subplan merge conflicts are detected but never surfaced to the user for resolution — this is v3.3.0 Deliverable #6 (three-way merge conflicts surfaced to user) which is missing. This is a core M4 deliverable gap. Assigning to **v3.3.0** (Corrections + Subplans + Checkpoints). Priority **Medium** — conflicts are detected but silently swallowed. MoSCoW: **Should Have** — conflict surfacing is important for user control over merge outcomes. --- **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#9160
No description provided.