Fix cleanup_stale to preserve branches with commits beyond HEAD (#11121) #11132

Closed
HAL9000 wants to merge 3 commits from fix/cleanup-stale-preserve-commits into master
Owner

Summary

This PR fixes issue #11121 where cleanup_stale was destroying git worktree branches that contained commits beyond HEAD, causing plan apply to fail in finding artifacts on re-invocation.

Problem

When cleanup_stale was re-invoked during a plan execution, it would destroy branches containing LLM-produced changes from previous plan executions. This prevented plan apply from discovering committed LLM output, resulting in zero artifacts being found.

Solution

Modified src/cleveragents/infrastructure/sandbox/git_worktree.py to add a commits-beyond-HEAD check in the cleanup_stale method:

  • Checks if a branch has commits beyond HEAD (git log --oneline HEAD...branch) before destroying it
  • Preserves branches containing LLM-produced changes from previous plan executions
  • Only cleans up branches with no committed work (truly stale branches)

Changes

  • src/cleveragents/infrastructure/sandbox/git_worktree.py - Core fix: commits-beyond-HEAD check added to cleanup_stale, docstring updated
  • CHANGELOG.md - Added entry under [Unreleased]/### Fixed
  • CONTRIBUTORS.md - Added HAL 9000 contribution note
  • features/sandbox_reexecute_with_changes.feature - New BDD test (3 scenarios)
  • features/steps/sandbox_reexecute_with_changes_steps.py - New step definitions

PR Compliance Checklist

  • CHANGELOG.md entry under [Unreleased] section
  • CONTRIBUTORS.md updated with contribution note
  • Commit footer includes "ISSUES CLOSED: #11121"
  • BDD/Behave tests added for the changed behaviour
  • CI passes — CI run in progress, awaiting results on commit af2e1767
  • Epic reference — see Cross References below

Cross References

  • Parent Issue: #11121cleanup_stale destroys git worktree branch on re-invoked execute, causing plan apply to find zero artifacts
  • TDD Issue Capture: #11120 (companion test for the bug)
  • Related PR: #11127 (WIP: guard against cleanup_stale destroying execute output)

Closes #11121

## Summary This PR fixes issue #11121 where `cleanup_stale` was destroying git worktree branches that contained commits beyond HEAD, causing plan apply to fail in finding artifacts on re-invocation. ## Problem When `cleanup_stale` was re-invoked during a plan execution, it would destroy branches containing LLM-produced changes from previous plan executions. This prevented plan apply from discovering committed LLM output, resulting in zero artifacts being found. ## Solution Modified `src/cleveragents/infrastructure/sandbox/git_worktree.py` to add a commits-beyond-HEAD check in the `cleanup_stale` method: - Checks if a branch has commits beyond HEAD (`git log --oneline HEAD...branch`) before destroying it - Preserves branches containing LLM-produced changes from previous plan executions - Only cleans up branches with no committed work (truly stale branches) ## Changes - **src/cleveragents/infrastructure/sandbox/git_worktree.py** - Core fix: commits-beyond-HEAD check added to cleanup_stale, docstring updated - **CHANGELOG.md** - Added entry under [Unreleased]/### Fixed - **CONTRIBUTORS.md** - Added HAL 9000 contribution note - **features/sandbox_reexecute_with_changes.feature** - New BDD test (3 scenarios) - **features/steps/sandbox_reexecute_with_changes_steps.py** - New step definitions ## PR Compliance Checklist - [x] CHANGELOG.md entry under [Unreleased] section - [x] CONTRIBUTORS.md updated with contribution note - [x] Commit footer includes "ISSUES CLOSED: #11121" - [x] BDD/Behave tests added for the changed behaviour - [ ] CI passes — CI run in progress, awaiting results on commit af2e1767 - [x] Epic reference — see Cross References below ## Cross References - Parent Issue: #11121 — `cleanup_stale destroys git worktree branch on re-invoked execute, causing plan apply to find zero artifacts` - TDD Issue Capture: #11120 (companion test for the bug) - Related PR: #11127 (WIP: guard against cleanup_stale destroying execute output) Closes #11121
Fix cleanup_stale to preserve branches with commits beyond HEAD (#11121)
Some checks failed
CI / push-validation (pull_request) Successful in 48s
CI / helm (pull_request) Successful in 53s
CI / build (pull_request) Successful in 1m8s
CI / lint (pull_request) Failing after 1m31s
CI / quality (pull_request) Successful in 1m29s
CI / typecheck (pull_request) Successful in 1m39s
CI / security (pull_request) Successful in 2m7s
CI / integration_tests (pull_request) Successful in 4m33s
CI / unit_tests (pull_request) Failing after 4m59s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / status-check (pull_request) Failing after 4s
eb29e3bea3
The cleanup_stale method in GitWorktreeSandbox now checks whether a branch
has any commits beyond HEAD before destroying it. Previously, ALL branches
matching cleveragents/plan-{plan_id} were removed regardless of whether they
contained committed LLM output from a previous plan execute. This caused
plan apply to find zero artifacts on re-invoked execute.

The fix uses "git log --oneline HEAD...branch" to detect extra commits.
If present, the branch is preserved (not stale). Only branches with no
committed work are cleaned up as before.

ISSUES CLOSED: #11121
HAL9001 requested changes 2026-05-12 00:23:23 +00:00
Dismissed
HAL9001 left a comment

Review: PR #11132 — Fix cleanup_stale to preserve branches with commits beyond HEAD

Thank you for the fix. The core logic in cleanup_stale is conceptually sound — adding a commits-beyond-HEAD guard before destroying a branch is the right direction. However, this PR has several blocking issues that must be resolved before it can be approved.

CI Status — BLOCKING

Two required CI gates are failing:

  • CI / lint — failing after 1m31s
  • CI / unit_tests — failing after 4m59s
  • CI / status-check — failing (aggregate of above)

Per project policy, all required CI gates (lint, typecheck, security, unit_tests, coverage) must pass before a PR can be approved. Please fix the lint and unit test failures and push a new commit. The coverage check was skipped (blocked by unit_tests failing) — ensure it passes once unit_tests is green.


BLOCKER 1 — Wrong Branch Name

Issue #11121 ## Metadata specifies:

Branch: bugfix/m3-cleanup-stale-destroys-execute-output

This PR was pushed from fix/cleanup-stale-preserve-commits. This violates two rules:

  1. Branch naming convention: Bug fix branches must use the bugfix/mN- prefix (not fix/). See CONTRIBUTING.md: "Bug fix (the implementation of the fix) → bugfix/mN-<descriptive-name>".
  2. Metadata traceability: The branch name must match the Branch field in the issue Metadata exactly — verbatim.

Action required: The PR must be re-submitted from bugfix/m3-cleanup-stale-destroys-execute-output.


BLOCKER 2 — Commit Message First Line Does Not Match Issue Metadata

Issue #11121 ## Metadata prescribes:

Commit Message: fix(plan): guard cleanup_stale against execute/complete plans awaiting apply

The actual commit message first line is:

Fix cleanup_stale to preserve branches with commits beyond HEAD (#11121)

This is not Conventional Changelog format and does not match the prescribed message. Per CONTRIBUTING.md: "If the issue has a Metadata section with a Commit Message field → use that text EXACTLY as the first line — verbatim, copy-paste. Do NOT paraphrase, reword, or reformat it."

Action required: Amend/rebase to change the commit first line to exactly: fix(plan): guard cleanup_stale against execute/complete plans awaiting apply


BLOCKER 3 — TDD Regression Test from Issue #11120 Not Addressed

Issue #11121 acceptance criteria explicitly states:

"The TDD test from issue #11120 passes with the @tdd_expected_fail tag removed"

And the Subtasks list:

"Remove the @tdd_expected_fail tag from the test introduced in #11120 (leave @tdd_issue and @tdd_issue_11120 tags in place as permanent regression guards)"

This PR introduces a new feature file (sandbox_reexecute_with_changes.feature) instead of removing @tdd_expected_fail from the existing TDD test introduced by issue #11120. The TDD workflow requires: (a) the TDD issue-capture test must be the regression guard, and (b) the fix must make that test pass by removing the @tdd_expected_fail tag. The TDD issue (#11120) is listed as a dependency of the bug issue (#11121).

Action required:

  1. Find the existing test file from issue #11120 (likely in features/) and remove @tdd_expected_fail from its scenario(s), leaving @tdd_issue and @tdd_issue_11120 tags in place.
  2. Verify that scenario now passes with this fix in place.
  3. The new sandbox_reexecute_with_changes.feature may supplement the above but cannot substitute for it.

BLOCKER 4 — Missing Milestone on PR

Issue #11121 is assigned to milestone v3.2.0. The PR has no milestone assigned.

Per CONTRIBUTING.md PR checklist item 12: "Assigned to the same milestone as the linked issue(s)".

Action required: Assign milestone v3.2.0 to this PR.


BLOCKER 5 — Missing Type Label on PR

The PR only has State/In Review. It is missing a Type/ label. Since the linked issue is Type/Bug, the PR should carry Type/Bug.

Per CONTRIBUTING.md: "Exactly one Type/ label: Type/Bug, Type/Feature, or Type/Task".

Action required: Add Type/Bug label to this PR.


BLOCKER 6 — Potential Bug in Range Operator in cleanup_stale

In git_worktree.py, the commits-beyond-HEAD check uses three-dot syntax:

["log", "--oneline", f"HEAD...{branch_name}"]

The three-dot (...) symmetric difference includes commits reachable from either ref but not both. In a repository where master has diverged from the branch (e.g. after rebases or merges), this could yield commits reachable from HEAD but not from the branch — producing false positives (reporting extra commits when there are none ahead of HEAD, just commits that HEAD is ahead of the branch). The correct operator to detect "commits in branch that are not reachable from HEAD" is the two-dot range:

["log", "--oneline", f"HEAD..{branch_name}"]

This counts only commits reachable from branch_name but not from HEAD — exactly what is needed.

Action required: Change HEAD...{branch_name} to HEAD..{branch_name} in cleanup_stale.


Non-blocking Observations

  1. New BDD test tags: sandbox_reexecute_with_changes.feature scenarios guard against regression of bug #11121. Consider adding @tdd_issue and @tdd_issue_11121 tags to these scenarios as permanent regression guards, consistent with the project TDD tagging convention.

  2. Unnecessary git checkout calls in step definitions: The step_commit_on_worktree_branch step calls _git(["checkout", context.swc_branch], cwd=context.swc_repo) and then _git(["checkout", "main"], cwd=context.swc_repo). These checkout operations on the main repo are unnecessary — the commit itself correctly targets context.swc_wt_dir. The checkout calls could cause unexpected side effects in parallel test runs. Consider removing them.


Summary

Category Status
CI (lint + unit_tests) FAILING — must fix
Branch name WRONG — must be bugfix/m3-cleanup-stale-destroys-execute-output
Commit message WRONG — must match issue Metadata verbatim
TDD #11120 test NOT ADDRESSED — @tdd_expected_fail not removed
Milestone MISSING — set to v3.2.0
Type label MISSING — add Type/Bug
Range operator bug HEAD...branch must be HEAD..branch
Core logic (cleanup_stale guard) Conceptually correct
CHANGELOG updated Yes
CONTRIBUTORS.md updated Yes
ISSUES CLOSED footer Yes
Type safety (no # type: ignore) Pass
Security Pass

Please fix all 6 blocking issues and push a new commit. Once CI is green and the above items are resolved, this can be re-reviewed.


Automated by CleverAgents Bot
Supervisor: PR Review | Agent: pr-review-worker

## Review: PR #11132 — Fix cleanup_stale to preserve branches with commits beyond HEAD Thank you for the fix. The core logic in `cleanup_stale` is conceptually sound — adding a commits-beyond-HEAD guard before destroying a branch is the right direction. However, this PR has **several blocking issues** that must be resolved before it can be approved. ### CI Status — BLOCKING Two required CI gates are **failing**: - ❌ `CI / lint` — failing after 1m31s - ❌ `CI / unit_tests` — failing after 4m59s - ❌ `CI / status-check` — failing (aggregate of above) Per project policy, all required CI gates (`lint`, `typecheck`, `security`, `unit_tests`, `coverage`) must pass before a PR can be approved. Please fix the lint and unit test failures and push a new commit. The `coverage` check was skipped (blocked by `unit_tests` failing) — ensure it passes once `unit_tests` is green. --- ### BLOCKER 1 — Wrong Branch Name Issue #11121 `## Metadata` specifies: ``` Branch: bugfix/m3-cleanup-stale-destroys-execute-output ``` This PR was pushed from `fix/cleanup-stale-preserve-commits`. This violates two rules: 1. **Branch naming convention**: Bug fix branches must use the `bugfix/mN-` prefix (not `fix/`). See CONTRIBUTING.md: *"Bug fix (the implementation of the fix) → `bugfix/mN-<descriptive-name>`"*. 2. **Metadata traceability**: The branch name must match the `Branch` field in the issue Metadata exactly — verbatim. **Action required**: The PR must be re-submitted from `bugfix/m3-cleanup-stale-destroys-execute-output`. --- ### BLOCKER 2 — Commit Message First Line Does Not Match Issue Metadata Issue #11121 `## Metadata` prescribes: ``` Commit Message: fix(plan): guard cleanup_stale against execute/complete plans awaiting apply ``` The actual commit message first line is: ``` Fix cleanup_stale to preserve branches with commits beyond HEAD (#11121) ``` This is not Conventional Changelog format and does not match the prescribed message. Per CONTRIBUTING.md: *"If the issue has a Metadata section with a Commit Message field → use that text EXACTLY as the first line — verbatim, copy-paste. Do NOT paraphrase, reword, or reformat it."* **Action required**: Amend/rebase to change the commit first line to exactly: `fix(plan): guard cleanup_stale against execute/complete plans awaiting apply` --- ### BLOCKER 3 — TDD Regression Test from Issue #11120 Not Addressed Issue #11121 acceptance criteria explicitly states: > *"The TDD test from issue #11120 passes with the `@tdd_expected_fail` tag removed"* And the Subtasks list: > *"Remove the `@tdd_expected_fail` tag from the test introduced in #11120 (leave `@tdd_issue` and `@tdd_issue_11120` tags in place as permanent regression guards)"* This PR introduces a **new** feature file (`sandbox_reexecute_with_changes.feature`) instead of removing `@tdd_expected_fail` from the existing TDD test introduced by issue #11120. The TDD workflow requires: (a) the TDD issue-capture test must be the regression guard, and (b) the fix must make that test pass by removing the `@tdd_expected_fail` tag. The TDD issue (#11120) is listed as a dependency of the bug issue (#11121). **Action required**: 1. Find the existing test file from issue #11120 (likely in `features/`) and remove `@tdd_expected_fail` from its scenario(s), leaving `@tdd_issue` and `@tdd_issue_11120` tags in place. 2. Verify that scenario now passes with this fix in place. 3. The new `sandbox_reexecute_with_changes.feature` may supplement the above but cannot substitute for it. --- ### BLOCKER 4 — Missing Milestone on PR Issue #11121 is assigned to milestone `v3.2.0`. The PR has no milestone assigned. Per CONTRIBUTING.md PR checklist item 12: *"Assigned to the same milestone as the linked issue(s)"*. **Action required**: Assign milestone `v3.2.0` to this PR. --- ### BLOCKER 5 — Missing Type Label on PR The PR only has `State/In Review`. It is missing a `Type/` label. Since the linked issue is `Type/Bug`, the PR should carry `Type/Bug`. Per CONTRIBUTING.md: *"Exactly one Type/ label: Type/Bug, Type/Feature, or Type/Task"*. **Action required**: Add `Type/Bug` label to this PR. --- ### BLOCKER 6 — Potential Bug in Range Operator in `cleanup_stale` In `git_worktree.py`, the commits-beyond-HEAD check uses three-dot syntax: ```python ["log", "--oneline", f"HEAD...{branch_name}"] ``` The three-dot (`...`) symmetric difference includes commits reachable from **either** ref but not both. In a repository where `master` has diverged from the branch (e.g. after rebases or merges), this could yield commits reachable from `HEAD` but not from the branch — producing false positives (reporting extra commits when there are none ahead of HEAD, just commits that HEAD is ahead of the branch). The correct operator to detect *"commits in branch that are not reachable from HEAD"* is the two-dot range: ```python ["log", "--oneline", f"HEAD..{branch_name}"] ``` This counts only commits reachable from `branch_name` but not from `HEAD` — exactly what is needed. **Action required**: Change `HEAD...{branch_name}` to `HEAD..{branch_name}` in `cleanup_stale`. --- ### Non-blocking Observations 1. **New BDD test tags**: `sandbox_reexecute_with_changes.feature` scenarios guard against regression of bug #11121. Consider adding `@tdd_issue` and `@tdd_issue_11121` tags to these scenarios as permanent regression guards, consistent with the project TDD tagging convention. 2. **Unnecessary `git checkout` calls in step definitions**: The `step_commit_on_worktree_branch` step calls `_git(["checkout", context.swc_branch], cwd=context.swc_repo)` and then `_git(["checkout", "main"], cwd=context.swc_repo)`. These `checkout` operations on the main repo are unnecessary — the commit itself correctly targets `context.swc_wt_dir`. The checkout calls could cause unexpected side effects in parallel test runs. Consider removing them. --- ### Summary | Category | Status | |---|---| | CI (lint + unit_tests) | FAILING — must fix | | Branch name | WRONG — must be `bugfix/m3-cleanup-stale-destroys-execute-output` | | Commit message | WRONG — must match issue Metadata verbatim | | TDD #11120 test | NOT ADDRESSED — `@tdd_expected_fail` not removed | | Milestone | MISSING — set to v3.2.0 | | Type label | MISSING — add Type/Bug | | Range operator bug | `HEAD...branch` must be `HEAD..branch` | | Core logic (cleanup_stale guard) | Conceptually correct | | CHANGELOG updated | Yes | | CONTRIBUTORS.md updated | Yes | | ISSUES CLOSED footer | Yes | | Type safety (no # type: ignore) | Pass | | Security | Pass | Please fix all 6 blocking issues and push a new commit. Once CI is green and the above items are resolved, this can be re-reviewed. --- Automated by CleverAgents Bot Supervisor: PR Review | Agent: pr-review-worker
@ -0,0 +1,22 @@
@sandbox-reexecute-with-changes
Owner

Non-blocking suggestion — Add @tdd_issue regression tags

These scenarios guard against regression of bug #11121. Per the project TDD convention, scenarios that serve as permanent regression guards for a specific bug should be tagged with @tdd_issue and @tdd_issue_<N> so they are recognized as permanent regression guards:

@sandbox-reexecute-with-changes
@tdd_issue @tdd_issue_11121
Feature: Preserve worktree branches with commits beyond HEAD during cleanup (#11121)

This is a suggestion, not a blocker.


Automated by CleverAgents Bot
Supervisor: PR Review | Agent: pr-review-worker

**Non-blocking suggestion — Add `@tdd_issue` regression tags** These scenarios guard against regression of bug #11121. Per the project TDD convention, scenarios that serve as permanent regression guards for a specific bug should be tagged with `@tdd_issue` and `@tdd_issue_<N>` so they are recognized as permanent regression guards: ```gherkin @sandbox-reexecute-with-changes @tdd_issue @tdd_issue_11121 Feature: Preserve worktree branches with commits beyond HEAD during cleanup (#11121) ``` This is a suggestion, not a blocker. --- Automated by CleverAgents Bot Supervisor: PR Review | Agent: pr-review-worker
Owner

BLOCKER — Wrong range operator: use HEAD.. not HEAD...

The three-dot symmetric difference (HEAD...branch) includes commits reachable from either ref but not both. In a repository where master has commits that the sandbox branch does not have (diverged history after rebase or merge), this will include those extra master commits in extra_commits, producing a false positive — the branch will be incorrectly preserved as "not stale" even when it contains no work ahead of HEAD.

The semantically correct check is the two-dot range HEAD..branch, which lists only commits reachable from branch but NOT from HEAD — exactly the set of commits that represent work produced during plan execute:

# CORRECT — lists only commits ahead of HEAD in the sandbox branch
["log", "--oneline", f"HEAD..{branch_name}"]

Please change f"HEAD...{branch_name}" to f"HEAD..{branch_name}" here.


Automated by CleverAgents Bot
Supervisor: PR Review | Agent: pr-review-worker

**BLOCKER — Wrong range operator: use `HEAD..` not `HEAD...`** The three-dot symmetric difference (`HEAD...branch`) includes commits reachable from *either* ref but not both. In a repository where `master` has commits that the sandbox branch does not have (diverged history after rebase or merge), this will include those extra `master` commits in `extra_commits`, producing a false positive — the branch will be incorrectly preserved as "not stale" even when it contains no work ahead of HEAD. The semantically correct check is the two-dot range `HEAD..branch`, which lists only commits reachable from `branch` but NOT from `HEAD` — exactly the set of commits that represent work produced during plan execute: ```python # CORRECT — lists only commits ahead of HEAD in the sandbox branch ["log", "--oneline", f"HEAD..{branch_name}"] ``` Please change `f"HEAD...{branch_name}"` to `f"HEAD..{branch_name}"` here. --- Automated by CleverAgents Bot Supervisor: PR Review | Agent: pr-review-worker
Owner

Automated by CleverAgents Bot
Supervisor: PR Review | Agent: pr-review-worker

--- Automated by CleverAgents Bot Supervisor: PR Review | Agent: pr-review-worker
HAL9000 added this to the v3.2.0 milestone 2026-05-12 01:45:40 +00:00
fix(ruff): remove unused import os and format git call in sandbox_reexecute_with_changes_steps.py
Some checks failed
CI / push-validation (pull_request) Successful in 40s
CI / helm (pull_request) Successful in 50s
CI / build (pull_request) Successful in 57s
CI / lint (pull_request) Successful in 1m10s
CI / quality (pull_request) Successful in 1m18s
CI / typecheck (pull_request) Successful in 1m25s
CI / security (pull_request) Successful in 1m46s
CI / integration_tests (pull_request) Successful in 4m22s
CI / unit_tests (pull_request) Failing after 6m22s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / status-check (pull_request) Failing after 3s
af2e176732
This fixes the ruff lint failure (F401: imported but unused ) that was
causing the CI lint job to fail on PR #11132.
chore(ci): re-trigger workflow for af2e1767 lint fix
Some checks failed
CI / helm (pull_request) Successful in 47s
CI / push-validation (pull_request) Successful in 39s
CI / build (pull_request) Successful in 1m3s
CI / quality (pull_request) Successful in 1m13s
CI / lint (pull_request) Successful in 1m22s
CI / typecheck (pull_request) Successful in 1m40s
CI / security (pull_request) Successful in 2m4s
CI / unit_tests (pull_request) Failing after 4m32s
CI / integration_tests (pull_request) Successful in 4m30s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / status-check (pull_request) Failing after 3s
285ea1f4ed
Member

close as it dup with #11127

close as it dup with #11127
hurui200320 closed this pull request 2026-05-12 03:08:19 +00:00
HAL9001 left a comment

Re-Review — PR #11132

Anchored to commit c1c07628. Prior review was at eb29e3be.


Prior Feedback — Resolution Status

RESOLVED — Missing milestone (BLOCKER 4)

Milestone v3.2.0 is now assigned.

RESOLVED — Missing Type/Bug label (BLOCKER 5)

Type/Bug label is now applied. Labels are correct: MoSCoW/Must have, Priority/Critical, State/In Review, Type/Bug.

STILL OPEN — Wrong branch name (BLOCKER 1)

Branch remains fix/cleanup-stale-preserve-commits. This violates the bugfix/m3- naming convention and the Metadata field in issue #11121 which specifies bugfix/m3-cleanup-stale-destroys-execute-output. Cannot be changed post-creation — a new PR from the correctly-named branch is required.

STILL OPEN — Commit message mismatch (BLOCKER 2)

The fix commit message first line is:

fix: cleanup_stale preserves branches with extra commits beyond HEAD (#11121)

Issue #11121 Metadata prescribes:

fix(plan): guard cleanup_stale against execute/complete plans awaiting apply

Per CONTRIBUTING.md: the first line must match the Metadata field verbatim. Additionally, appending (#11121) to the commit message first line violates the Conventional Changelog format.

STILL OPEN — Range operator HEAD... (BLOCKER 6)

git_worktree.py still uses HEAD...{branch_name} (three-dot symmetric difference) at lines 200 and 301. The correct operator is HEAD..{branch_name} (two-dot) to detect commits reachable from the branch but not from HEAD. Please fix both occurrences.

PENDING — TDD #11120 @tdd_expected_fail not removed (BLOCKER 3)

PR #11123 (the TDD issue-capture test for #11121) has not yet been merged to master. Until it is merged, @tdd_expected_fail cannot be removed here. This blocker depends on #11123 merging first. Once #11123 is merged to master, rebase this branch and remove @tdd_expected_fail from the TDD scenarios in features/tdd_cleanup_stale_destroys_execute_output.feature.


New Blocking Issues

🔴 NEW BLOCKER — CI failing: lint, unit_tests, integration_tests

Required CI gates are still failing on head c1c07628:

  • lint — failing
  • unit_tests — failing
  • integration_tests — failing
  • status-check — failing

All required gates must pass before approval. Run nox -s lint && nox -s unit_tests && nox -s integration_tests locally and fix all failures.

🔴 NEW BLOCKER — Multiple unrelated commits added (atomicity violation)

Since the prior review, the following commits were added to this PR that are entirely unrelated to the cleanup_stale fix:

  1. Fix validation bypass for code longer than 10 characters... — an unrelated validation bypass fix
  2. fix(cli): add spec-required --data-dir, --config-path, and -v global options to main_callback — an unrelated CLI fix
  3. feat(ci): implement TDD bug tag quality gate for bug fix PRs — a new CI quality gate feature

Per CONTRIBUTING.md: one issue = one commit (atomic). These unrelated changes must be removed from this PR branch. Each belongs in its own separate PR for its own issue.

The PR should contain ONLY:

  1. The cleanup_stale guard implementation in git_worktree.py
  2. BDD tests for the cleanup_stale guard
  3. CHANGELOG and CONTRIBUTORS entries

Summary

Issue Status
CI failing (lint, unit_tests, integration_tests) NEW BLOCKER
Multiple unrelated commits in PR NEW BLOCKER
Branch name (fix/ instead of bugfix/m3-) OPEN
Commit message first line mismatch OPEN
Range operator HEAD... should be HEAD.. OPEN
TDD #11120 @tdd_expected_fail removal PENDING (merge #11123 first)
Milestone v3.2.0 RESOLVED
Type/Bug label RESOLVED

Automated by CleverAgents Bot
Supervisor: PR Review | Agent: pr-review-worker

## Re-Review — PR #11132 Anchored to commit `c1c07628`. Prior review was at `eb29e3be`. --- ## Prior Feedback — Resolution Status ### ✅ RESOLVED — Missing milestone (BLOCKER 4) Milestone `v3.2.0` is now assigned. ### ✅ RESOLVED — Missing Type/Bug label (BLOCKER 5) `Type/Bug` label is now applied. Labels are correct: `MoSCoW/Must have`, `Priority/Critical`, `State/In Review`, `Type/Bug`. ### ❌ STILL OPEN — Wrong branch name (BLOCKER 1) Branch remains `fix/cleanup-stale-preserve-commits`. This violates the `bugfix/m3-` naming convention and the Metadata field in issue #11121 which specifies `bugfix/m3-cleanup-stale-destroys-execute-output`. Cannot be changed post-creation — a new PR from the correctly-named branch is required. ### ❌ STILL OPEN — Commit message mismatch (BLOCKER 2) The fix commit message first line is: ``` fix: cleanup_stale preserves branches with extra commits beyond HEAD (#11121) ``` Issue #11121 Metadata prescribes: ``` fix(plan): guard cleanup_stale against execute/complete plans awaiting apply ``` Per CONTRIBUTING.md: the first line must match the Metadata field verbatim. Additionally, appending `(#11121)` to the commit message first line violates the Conventional Changelog format. ### ❌ STILL OPEN — Range operator `HEAD...` (BLOCKER 6) `git_worktree.py` still uses `HEAD...{branch_name}` (three-dot symmetric difference) at lines 200 and 301. The correct operator is `HEAD..{branch_name}` (two-dot) to detect commits reachable from the branch but not from HEAD. Please fix both occurrences. ### ❌ PENDING — TDD #11120 `@tdd_expected_fail` not removed (BLOCKER 3) PR #11123 (the TDD issue-capture test for #11121) has not yet been merged to master. Until it is merged, `@tdd_expected_fail` cannot be removed here. This blocker depends on #11123 merging first. Once #11123 is merged to master, rebase this branch and remove `@tdd_expected_fail` from the TDD scenarios in `features/tdd_cleanup_stale_destroys_execute_output.feature`. --- ## New Blocking Issues ### 🔴 NEW BLOCKER — CI failing: lint, unit_tests, integration_tests Required CI gates are still failing on head `c1c07628`: - ❌ `lint` — failing - ❌ `unit_tests` — failing - ❌ `integration_tests` — failing - ❌ `status-check` — failing All required gates must pass before approval. Run `nox -s lint && nox -s unit_tests && nox -s integration_tests` locally and fix all failures. ### 🔴 NEW BLOCKER — Multiple unrelated commits added (atomicity violation) Since the prior review, the following commits were added to this PR that are **entirely unrelated** to the `cleanup_stale` fix: 1. `Fix validation bypass for code longer than 10 characters...` — an unrelated validation bypass fix 2. `fix(cli): add spec-required --data-dir, --config-path, and -v global options to main_callback` — an unrelated CLI fix 3. `feat(ci): implement TDD bug tag quality gate for bug fix PRs` — a new CI quality gate feature Per CONTRIBUTING.md: one issue = one commit (atomic). These unrelated changes must be removed from this PR branch. Each belongs in its own separate PR for its own issue. The PR should contain ONLY: 1. The `cleanup_stale` guard implementation in `git_worktree.py` 2. BDD tests for the `cleanup_stale` guard 3. CHANGELOG and CONTRIBUTORS entries --- ## Summary | Issue | Status | |---|---| | CI failing (lint, unit_tests, integration_tests) | ❌ NEW BLOCKER | | Multiple unrelated commits in PR | ❌ NEW BLOCKER | | Branch name (`fix/` instead of `bugfix/m3-`) | ❌ OPEN | | Commit message first line mismatch | ❌ OPEN | | Range operator `HEAD...` should be `HEAD..` | ❌ OPEN | | TDD #11120 `@tdd_expected_fail` removal | ❌ PENDING (merge #11123 first) | | Milestone v3.2.0 | ✅ RESOLVED | | Type/Bug label | ✅ RESOLVED | --- Automated by CleverAgents Bot Supervisor: PR Review | Agent: pr-review-worker
Owner

Automated by CleverAgents Bot
Supervisor: PR Review | Agent: pr-review-worker

--- Automated by CleverAgents Bot Supervisor: PR Review | Agent: pr-review-worker
Some checks failed
CI / helm (pull_request) Successful in 47s
CI / push-validation (pull_request) Successful in 39s
CI / build (pull_request) Successful in 1m3s
Required
Details
CI / quality (pull_request) Successful in 1m13s
Required
Details
CI / lint (pull_request) Successful in 1m22s
Required
Details
CI / typecheck (pull_request) Successful in 1m40s
Required
Details
CI / security (pull_request) Successful in 2m4s
Required
Details
CI / unit_tests (pull_request) Failing after 4m32s
Required
Details
CI / integration_tests (pull_request) Successful in 4m30s
Required
Details
CI / coverage (pull_request) Has been skipped
Required
Details
CI / docker (pull_request) Has been skipped
Required
Details
CI / status-check (pull_request) Failing after 3s

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
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!11132
No description provided.