[BUG] v3.3.0 Deliverable #6 missing: subplan merge conflicts not surfaced to user in CLI #9440

Open
opened 2026-04-14 17:51:51 +00:00 by HAL9000 · 1 comment
Owner

Metadata

  • Commit Message: fix(cli): surface subplan merge conflicts to user with CONFLICT markers and prompt
  • Branch: bugfix/m3-subplan-merge-conflict-surfacing

Background and Context

The v3.3.0 milestone specification (docs/specification.md §46871) defines Deliverable #6 as:

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

The SubplanMergeService (src/cleveragents/application/services/subplan_merge_service.py) correctly detects merge conflicts and stores them in SubplanMergeResult.conflict_files (line 64). The GitMergeStrategy (src/cleveragents/infrastructure/sandbox/merge.py) correctly produces git-style <<<<<<</=======/>>>>>>> conflict markers in merged content (lines 173–178).

However, the CLI (src/cleveragents/cli/commands/plan.py) has no code to:

  1. Check SubplanExecutionResult.merge_result.conflict_files after subplan execution
  2. Display the conflict markers to the user
  3. Prompt the user for resolution

A search of the entire CLI codebase confirms: grep -r "conflict_files\|merge_result\|has_conflict\|CONFLICT" src/cleveragents/cli/ returns zero matches (only EXIT_CONFLICT constant in constants.py, which is defined but never used in the plan command flow).

Current Behavior

When parallel subplans produce conflicting changes to the same file:

  1. SubplanMergeService.merge() detects the conflict and populates SubplanMergeResult.conflict_files
  2. SubplanExecutionService.execute_all() logs a warning: "Merge conflict after subplan execution" and sets all_succeeded = False
  3. The parent plan's error_details is annotated with subplan_execution_failed: true and failed_subplan_ids
  4. The user sees no conflict markers, no list of conflicting files, and no prompt for resolution

The conflict information is silently discarded after logging.

Expected Behavior

Per docs/specification.md §46871 (v3.3.0 Deliverable #6):

When subplan execution produces merge conflicts, the CLI must:

  1. Display the conflicting file paths to the user
  2. Show the git-style CONFLICT markers in the affected files (or at minimum indicate where conflicts exist)
  3. Prompt the user for resolution (e.g., via agents plan correct or a dedicated conflict resolution flow)

The EXIT_CONFLICT exit code (value 4) defined in src/cleveragents/cli/constants.py should be used when conflicts are detected.

Acceptance Criteria

  • After subplan execution, if exec_result.merge_result is not None and exec_result.merge_result.conflict_files is non-empty, the CLI displays the list of conflicting files
  • The CLI shows the conflict markers (or file content with markers) for each conflicting file
  • The CLI prompts the user with instructions for resolution (e.g., "Run agents plan correct to resolve conflicts")
  • The CLI exits with EXIT_CONFLICT (code 4) when conflicts are detected
  • BDD scenario added to features/subplan_execution.feature or a new feature file covering the CLI conflict surfacing behavior
  • Robot Framework integration test added under robot/ for the end-to-end conflict surfacing flow

Supporting Information

  • Spec reference: docs/specification.md line 46871 (v3.3.0 Deliverable #6)
  • SubplanMergeResult.conflict_files: src/cleveragents/application/services/subplan_merge_service.py line 64
  • GitMergeStrategy conflict markers: src/cleveragents/infrastructure/sandbox/merge.py lines 173–178
  • EXIT_CONFLICT constant: src/cleveragents/cli/constants.py line 27 (defined but unused in plan flow)
  • SubplanExecutionService.execute_all() merge handling: src/cleveragents/application/services/subplan_execution_service.py lines 230–237

Subtasks

  • Add conflict detection check in plan execute / plan run CLI flow after subplan execution
  • Display conflicting file paths to user when merge_result.conflict_files is non-empty
  • Display conflict markers (or file content with markers) for each conflicting file
  • Prompt user with resolution instructions
  • Use EXIT_CONFLICT (code 4) exit code when conflicts are detected
  • Tests (Behave): Add BDD scenario for CLI conflict surfacing in subplan execution
  • Tests (Robot): Add Robot Framework integration test for end-to-end conflict surfacing
  • Verify coverage ≥ 97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

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.
  • agents plan execute (or equivalent) displays conflict markers and prompts the user when subplan merge conflicts occur.
  • EXIT_CONFLICT (code 4) is returned when conflicts are detected.

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


Automated by CleverAgents Bot
Agent: new-issue-creator

## Metadata - **Commit Message**: `fix(cli): surface subplan merge conflicts to user with CONFLICT markers and prompt` - **Branch**: `bugfix/m3-subplan-merge-conflict-surfacing` ## Background and Context The v3.3.0 milestone specification (`docs/specification.md` §46871) defines Deliverable #6 as: > "Merge conflicts surfaced to user for resolution | §Merge Strategies — Conflict Resolution | Conflicting changes produce `CONFLICT` markers; user prompted" The `SubplanMergeService` (`src/cleveragents/application/services/subplan_merge_service.py`) correctly detects merge conflicts and stores them in `SubplanMergeResult.conflict_files` (line 64). The `GitMergeStrategy` (`src/cleveragents/infrastructure/sandbox/merge.py`) correctly produces git-style `<<<<<<<`/`=======`/`>>>>>>>` conflict markers in merged content (lines 173–178). However, the CLI (`src/cleveragents/cli/commands/plan.py`) has **no code** to: 1. Check `SubplanExecutionResult.merge_result.conflict_files` after subplan execution 2. Display the conflict markers to the user 3. Prompt the user for resolution A search of the entire CLI codebase confirms: `grep -r "conflict_files\|merge_result\|has_conflict\|CONFLICT" src/cleveragents/cli/` returns zero matches (only `EXIT_CONFLICT` constant in `constants.py`, which is defined but never used in the plan command flow). ## Current Behavior When parallel subplans produce conflicting changes to the same file: 1. `SubplanMergeService.merge()` detects the conflict and populates `SubplanMergeResult.conflict_files` 2. `SubplanExecutionService.execute_all()` logs a warning: `"Merge conflict after subplan execution"` and sets `all_succeeded = False` 3. The parent plan's `error_details` is annotated with `subplan_execution_failed: true` and `failed_subplan_ids` 4. **The user sees no conflict markers, no list of conflicting files, and no prompt for resolution** The conflict information is silently discarded after logging. ## Expected Behavior Per `docs/specification.md` §46871 (v3.3.0 Deliverable #6): When subplan execution produces merge conflicts, the CLI must: 1. Display the conflicting file paths to the user 2. Show the git-style `CONFLICT` markers in the affected files (or at minimum indicate where conflicts exist) 3. Prompt the user for resolution (e.g., via `agents plan correct` or a dedicated conflict resolution flow) The `EXIT_CONFLICT` exit code (value `4`) defined in `src/cleveragents/cli/constants.py` should be used when conflicts are detected. ## Acceptance Criteria - [ ] After subplan execution, if `exec_result.merge_result` is not None and `exec_result.merge_result.conflict_files` is non-empty, the CLI displays the list of conflicting files - [ ] The CLI shows the conflict markers (or file content with markers) for each conflicting file - [ ] The CLI prompts the user with instructions for resolution (e.g., "Run `agents plan correct` to resolve conflicts") - [ ] The CLI exits with `EXIT_CONFLICT` (code 4) when conflicts are detected - [ ] BDD scenario added to `features/subplan_execution.feature` or a new feature file covering the CLI conflict surfacing behavior - [ ] Robot Framework integration test added under `robot/` for the end-to-end conflict surfacing flow ## Supporting Information - Spec reference: `docs/specification.md` line 46871 (v3.3.0 Deliverable #6) - `SubplanMergeResult.conflict_files`: `src/cleveragents/application/services/subplan_merge_service.py` line 64 - `GitMergeStrategy` conflict markers: `src/cleveragents/infrastructure/sandbox/merge.py` lines 173–178 - `EXIT_CONFLICT` constant: `src/cleveragents/cli/constants.py` line 27 (defined but unused in plan flow) - `SubplanExecutionService.execute_all()` merge handling: `src/cleveragents/application/services/subplan_execution_service.py` lines 230–237 ## Subtasks - [ ] Add conflict detection check in `plan execute` / `plan run` CLI flow after subplan execution - [ ] Display conflicting file paths to user when `merge_result.conflict_files` is non-empty - [ ] Display conflict markers (or file content with markers) for each conflicting file - [ ] Prompt user with resolution instructions - [ ] Use `EXIT_CONFLICT` (code 4) exit code when conflicts are detected - [ ] Tests (Behave): Add BDD scenario for CLI conflict surfacing in subplan execution - [ ] Tests (Robot): Add Robot Framework integration test for end-to-end conflict surfacing - [ ] Verify coverage ≥ 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## 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. - `agents plan execute` (or equivalent) displays conflict markers and prompts the user when subplan merge conflicts occur. - `EXIT_CONFLICT` (code 4) is returned when conflicts are detected. --- **Automated by CleverAgents Bot** Supervisor: UAT Test Pool | Agent: uat-test-pool-supervisor --- **Automated by CleverAgents Bot** Agent: new-issue-creator
Author
Owner

🔄 Triage Decision [AUTO-OWNR-2]: This issue is a duplicate of #9160 which is already verified as MoSCoW/Should have, Priority/Medium for v3.3.0. Closing as duplicate.


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

🔄 **Triage Decision [AUTO-OWNR-2]**: This issue is a duplicate of #9160 which is already verified as `MoSCoW/Should have`, `Priority/Medium` for v3.3.0. Closing as duplicate. --- **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#9440
No description provided.