fix(sandbox): use spec-required cleveragents/plan-<plan_id> branch naming in GitWorktreeSandbox #3263

Merged
freemo merged 1 commit from fix/git-worktree-branch-naming into master 2026-04-05 21:09:06 +00:00
Owner

Summary

Fixes a branch naming convention bug in GitWorktreeSandbox.create() where sandbox branches were being created as sandbox/<plan_id> instead of the spec-required cleveragents/plan-<plan_id> format. This ensures all CleverAgents-managed git branches are correctly namespaced under the cleveragents/ prefix as defined in the specification.

Changes

  • src/cleveragents/infrastructure/sandbox/git_worktree.py:

    • Updated branch name assignment from f"sandbox/{safe_plan_id}" to f"cleveragents/plan-{safe_plan_id}" to match the spec-required naming format.
    • Updated the method docstring to reflect the corrected branch name pattern (cleveragents/plan-<plan_id> instead of sandbox/<plan_id>), keeping documentation in sync with the implementation.
  • features/steps/git_worktree_coverage_boost_steps.py:

    • Updated 4 test branch name fixtures to use the new naming convention:
      • sandbox/testcleveragents/plan-test
      • sandbox/cleanup-testcleveragents/plan-cleanup-test
      • sandbox/branch-delete-failcleveragents/plan-branch-delete-fail
    • Ensures all unit-level test scaffolding accurately reflects real-world branch names produced by the system under test.
  • features/garbage_collection.feature:

    • Updated scenario branch name fixture from sandbox/test-plan to cleveragents/plan-test-plan to align with the corrected naming convention.

Design Decisions

  • cleveragents/ namespace prefix: The spec designates cleveragents/ as the authoritative namespace for all branches managed by CleverAgents tooling. Using this prefix ensures branches are visually grouped in git clients, avoids collisions with user-created branches, and makes automated cleanup (garbage collection) unambiguous.
  • plan- infix: The plan- segment distinguishes plan-execution branches from any other future branch types that may be introduced under the cleveragents/ namespace. This matches the format shown in agents plan execute output in the specification.
  • Minimal blast radius: The fix is a single-line change to the production code path. All other changes are test fixture updates required to keep the test suite honest — no test logic was altered, only the expected branch name strings.
  • No migration path needed: Sandbox branches are ephemeral and tied to a single plan execution lifecycle.

Testing

  • lint: PASSED
  • typecheck: PASSED (0 errors, 0 warnings)
  • Python import verification: PASSED — confirmed cleveragents/plan-{safe_plan_id} is the branch name produced

Closes #2601


Automated by CleverAgents Bot
Supervisor: Implementation | Agent: ca-issue-worker

## Summary Fixes a branch naming convention bug in `GitWorktreeSandbox.create()` where sandbox branches were being created as `sandbox/<plan_id>` instead of the spec-required `cleveragents/plan-<plan_id>` format. This ensures all CleverAgents-managed git branches are correctly namespaced under the `cleveragents/` prefix as defined in the specification. ## Changes - **`src/cleveragents/infrastructure/sandbox/git_worktree.py`**: - Updated branch name assignment from `f"sandbox/{safe_plan_id}"` to `f"cleveragents/plan-{safe_plan_id}"` to match the spec-required naming format. - Updated the method docstring to reflect the corrected branch name pattern (`cleveragents/plan-<plan_id>` instead of `sandbox/<plan_id>`), keeping documentation in sync with the implementation. - **`features/steps/git_worktree_coverage_boost_steps.py`**: - Updated 4 test branch name fixtures to use the new naming convention: - `sandbox/test` → `cleveragents/plan-test` - `sandbox/cleanup-test` → `cleveragents/plan-cleanup-test` - `sandbox/branch-delete-fail` → `cleveragents/plan-branch-delete-fail` - Ensures all unit-level test scaffolding accurately reflects real-world branch names produced by the system under test. - **`features/garbage_collection.feature`**: - Updated scenario branch name fixture from `sandbox/test-plan` to `cleveragents/plan-test-plan` to align with the corrected naming convention. ## Design Decisions - **`cleveragents/` namespace prefix**: The spec designates `cleveragents/` as the authoritative namespace for all branches managed by CleverAgents tooling. Using this prefix ensures branches are visually grouped in git clients, avoids collisions with user-created branches, and makes automated cleanup (garbage collection) unambiguous. - **`plan-` infix**: The `plan-` segment distinguishes plan-execution branches from any other future branch types that may be introduced under the `cleveragents/` namespace. This matches the format shown in `agents plan execute` output in the specification. - **Minimal blast radius**: The fix is a single-line change to the production code path. All other changes are test fixture updates required to keep the test suite honest — no test logic was altered, only the expected branch name strings. - **No migration path needed**: Sandbox branches are ephemeral and tied to a single plan execution lifecycle. ## Testing - lint: PASSED - typecheck: PASSED (0 errors, 0 warnings) - Python import verification: PASSED — confirmed `cleveragents/plan-{safe_plan_id}` is the branch name produced ## Related Issues Closes #2601 --- **Automated by CleverAgents Bot** Supervisor: Implementation | Agent: ca-issue-worker
fix(sandbox): use spec-required cleveragents/plan- branch prefix in GitWorktreeSandbox
All checks were successful
CI / lint (pull_request) Successful in 26s
CI / quality (pull_request) Successful in 44s
CI / typecheck (pull_request) Successful in 55s
CI / security (pull_request) Successful in 54s
CI / build (pull_request) Successful in 20s
CI / helm (pull_request) Successful in 32s
CI / unit_tests (pull_request) Successful in 7m1s
CI / e2e_tests (pull_request) Successful in 17m26s
CI / integration_tests (pull_request) Successful in 23m31s
CI / coverage (pull_request) Successful in 11m6s
CI / docker (pull_request) Successful in 1m20s
CI / status-check (pull_request) Successful in 2s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Successful in 58m2s
4b9798bc40
- Implemented branch naming change in GitWorktreeSandbox.create() from sandbox/<plan_id> to cleveragents/plan-<plan_id>, located in src/cleveragents/infrastructure/sandbox/git_worktree.py
- Updated the create() method docstring to reflect the new branch naming convention
- Updated test fixtures:
  - features/steps/git_worktree_coverage_boost_steps.py: sandbox/test -> cleveragents/plan-test, sandbox/cleanup-test -> cleveragents/plan-cleanup-test, sandbox/branch-delete-fail -> cleveragents/plan-branch-delete-fail
- Updated scenario:
  - features/garbage_collection.feature: sandbox/test-plan -> cleveragents/plan-test-plan
- Design rationale:
  - Adopted the spec-required format: cleveragents/plan-{safe_plan_id} to align with the spec-defined namespace for all CleverAgents-managed git branches
  - Ensures consistent branch naming across code, tests, and features for easier policy enforcement and maintainability

ISSUES CLOSED: #2601
freemo added this to the v3.3.0 milestone 2026-04-05 08:46:18 +00:00
Author
Owner

🔒 Review claimed by reviewer-pool-1 [claim-token: reviewer-pool-1-3263-1775374200]


Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-continuous-pr-reviewer

🔒 Review claimed by reviewer-pool-1 [claim-token: reviewer-pool-1-3263-1775374200] --- **Automated by CleverAgents Bot** Supervisor: PR Review | Agent: ca-continuous-pr-reviewer
Author
Owner

🔒 Review claimed by reviewer-pool-1 [claim-token: reviewer-pool-1-3263-1775373000]


Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-continuous-pr-reviewer

🔒 Review claimed by reviewer-pool-1 [claim-token: reviewer-pool-1-3263-1775373000] --- **Automated by CleverAgents Bot** Supervisor: PR Review | Agent: ca-continuous-pr-reviewer
freemo left a comment

Review Complete — Clean, spec-aligned bug fix

Review Summary

Scope: Single-line production fix + test fixture updates (3 files, 7 insertions, 7 deletions)

Specification Alignment

  • The spec's agents plan execute output clearly shows Branch: cleveragents/plan-01HXM8C2 — this fix aligns the implementation with that requirement.
  • The cleveragents/ namespace prefix is the spec-defined namespace for all CleverAgents-managed git branches.
  • The plan- infix correctly distinguishes plan-execution branches from other potential future branch types.

Correctness

  • The production change is a single-line format string update: f"sandbox/{safe_plan_id}"f"cleveragents/plan-{safe_plan_id}".
  • The _sanitise_branch_name() function already handles slashes in its allowed character set, so the cleveragents/plan- prefix won't be mangled.
  • The fallback in _sanitise_branch_name() (empty input → "sandbox") would produce cleveragents/plan-sandbox, which is still correctly namespaced.
  • No other code paths reference the old sandbox/ branch prefix — the change is self-contained.

Test Quality

  • All 4 test fixture updates in git_worktree_coverage_boost_steps.py correctly mirror the new naming convention.
  • The garbage_collection.feature scenario fixture is updated to match.
  • No test logic was altered — only expected branch name strings, which is correct for a naming convention fix.
  • Verified via grep that no stale sandbox/<plan_id> branch name references remain in test files on this branch.

PR Metadata

  • Commit message: Conventional Changelog format (fix(sandbox): ...) with ISSUES CLOSED: #2601 footer ✓
  • PR body: Contains Closes #2601
  • Label: Type/Bug
  • Milestone: v3.3.0
  • Single commit: Clean history ✓

CI Status

  • lint | typecheck | security | quality | unit_tests | integration_tests | e2e_tests | build | helm
  • coverage, benchmark, docker, status-check: pending (waiting for upstream jobs)

Scheduling merge for when all checks complete.


Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-pr-self-reviewer

## ✅ Review Complete — Clean, spec-aligned bug fix ### Review Summary **Scope**: Single-line production fix + test fixture updates (3 files, 7 insertions, 7 deletions) ### Specification Alignment ✅ - The spec's `agents plan execute` output clearly shows `Branch: cleveragents/plan-01HXM8C2` — this fix aligns the implementation with that requirement. - The `cleveragents/` namespace prefix is the spec-defined namespace for all CleverAgents-managed git branches. - The `plan-` infix correctly distinguishes plan-execution branches from other potential future branch types. ### Correctness ✅ - The production change is a single-line format string update: `f"sandbox/{safe_plan_id}"` → `f"cleveragents/plan-{safe_plan_id}"`. - The `_sanitise_branch_name()` function already handles slashes in its allowed character set, so the `cleveragents/plan-` prefix won't be mangled. - The fallback in `_sanitise_branch_name()` (empty input → `"sandbox"`) would produce `cleveragents/plan-sandbox`, which is still correctly namespaced. - No other code paths reference the old `sandbox/` branch prefix — the change is self-contained. ### Test Quality ✅ - All 4 test fixture updates in `git_worktree_coverage_boost_steps.py` correctly mirror the new naming convention. - The `garbage_collection.feature` scenario fixture is updated to match. - No test logic was altered — only expected branch name strings, which is correct for a naming convention fix. - Verified via grep that no stale `sandbox/<plan_id>` branch name references remain in test files on this branch. ### PR Metadata ✅ - **Commit message**: Conventional Changelog format (`fix(sandbox): ...`) with `ISSUES CLOSED: #2601` footer ✓ - **PR body**: Contains `Closes #2601` ✓ - **Label**: `Type/Bug` ✓ - **Milestone**: `v3.3.0` ✓ - **Single commit**: Clean history ✓ ### CI Status - lint ✅ | typecheck ✅ | security ✅ | quality ✅ | unit_tests ✅ | integration_tests ✅ | e2e_tests ✅ | build ✅ | helm ✅ - coverage, benchmark, docker, status-check: pending (waiting for upstream jobs) Scheduling merge for when all checks complete. --- **Automated by CleverAgents Bot** Supervisor: PR Review | Agent: ca-pr-self-reviewer
freemo scheduled this pull request to auto merge when all checks succeed 2026-04-05 10:04:56 +00:00
freemo left a comment

Review Summary — LGTM (Self-Review)

Note

: This review would be APPROVED but Forgejo prevents self-approval. Posting as COMMENT for the record. External reviewers: this PR is recommended for approval.

Reviewed PR #3263 with focus on specification-compliance, requirements-coverage, and behavior-correctness.

Scope

Single-line production fix + docstring update in git_worktree.py, plus 4 test fixture updates across 2 test files. Clean, minimal blast radius.

Deep Dive Results

Specification Compliance

  • The spec's agents plan execute output clearly shows Branch: cleveragents/plan-01HXM8C2 — this fix aligns the implementation with that requirement.
  • The cleveragents/ namespace prefix is the spec-defined namespace for all CleverAgents-managed git branches.
  • The plan- infix correctly distinguishes plan-execution branches from other potential future branch types under the cleveragents/ namespace.
  • Verified via independent search: no other code paths in src/ reference the old sandbox/ branch prefix pattern — the change is self-contained.

Requirements Coverage

  • All 3 subtasks from issue #2601 are addressed:
    1. ✓ Branch name format changed from sandbox/<plan_id> to cleveragents/plan-<plan_id>
    2. create() docstring updated to reflect new naming
    3. ✓ Unit tests updated with new branch name format
  • Definition of Done criteria from the issue are fully satisfied.

Behavior Correctness

  • The _sanitise_branch_name() regex ([^a-zA-Z0-9/_.\-]+) already allows slashes in its character set, so the cleveragents/plan- prefix will not be mangled by sanitisation — verified by reading the regex definition.
  • The _sanitise_branch_name() fallback (empty input → "sandbox") would produce cleveragents/plan-sandbox, which is still correctly namespaced under the cleveragents/ prefix. The plan_id validation at the top of create() already rejects empty strings, so this fallback only triggers for strings composed entirely of disallowed characters — an extreme edge case.
  • No behavioral regressions: the change only affects the branch name string, not the worktree creation logic, commit flow, rollback, or cleanup.

Test Quality

  • All 4 test fixture branch name strings in git_worktree_coverage_boost_steps.py correctly updated:
    • sandbox/testcleveragents/plan-test
    • sandbox/cleanup-testcleveragents/plan-cleanup-test
    • sandbox/branch-delete-failcleveragents/plan-branch-delete-fail
  • garbage_collection.feature scenario fixture updated: sandbox/test-plancleveragents/plan-test-plan
  • No test logic was altered — only expected branch name strings, which is correct for a naming convention fix.
  • Robot Framework integration tests (robot/container_tool_exec.robot) reference /tmp/sandbox/ as a filesystem path, not a branch name — correctly left unchanged.

PR Metadata & Commit Standards

  • Commit message: Conventional Changelog format (fix(sandbox): ...) with ISSUES CLOSED: #2601 footer ✓
  • PR body: Contains Closes #2601
  • Label: Type/Bug
  • Milestone: v3.3.0 (matches issue) ✓
  • Single atomic commit: Clean history ✓
  • Branch name: fix/git-worktree-branch-naming

Minor Observations (Non-blocking)

  1. Pre-existing: _sanitise_branch_name() fallback value — The fallback value on line ~51 is still the string "sandbox", a leftover from the old naming convention. While this is not introduced by this PR and the resulting branch name (cleveragents/plan-sandbox) is still correctly namespaced, a future cleanup could change this to something more semantically appropriate like "unknown" or "default". Consider filing a low-priority follow-up issue.

Decision: APPROVED


Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-pr-self-reviewer

## Review Summary — LGTM ✅ (Self-Review) > **Note**: This review would be APPROVED but Forgejo prevents self-approval. Posting as COMMENT for the record. External reviewers: this PR is recommended for approval. Reviewed PR #3263 with focus on **specification-compliance**, **requirements-coverage**, and **behavior-correctness**. ### Scope Single-line production fix + docstring update in `git_worktree.py`, plus 4 test fixture updates across 2 test files. Clean, minimal blast radius. ### Deep Dive Results #### Specification Compliance ✅ - The spec's `agents plan execute` output clearly shows `Branch: cleveragents/plan-01HXM8C2` — this fix aligns the implementation with that requirement. - The `cleveragents/` namespace prefix is the spec-defined namespace for all CleverAgents-managed git branches. - The `plan-` infix correctly distinguishes plan-execution branches from other potential future branch types under the `cleveragents/` namespace. - Verified via independent search: no other code paths in `src/` reference the old `sandbox/` branch prefix pattern — the change is self-contained. #### Requirements Coverage ✅ - All 3 subtasks from issue #2601 are addressed: 1. ✓ Branch name format changed from `sandbox/<plan_id>` to `cleveragents/plan-<plan_id>` 2. ✓ `create()` docstring updated to reflect new naming 3. ✓ Unit tests updated with new branch name format - Definition of Done criteria from the issue are fully satisfied. #### Behavior Correctness ✅ - The `_sanitise_branch_name()` regex (`[^a-zA-Z0-9/_.\-]+`) already allows slashes in its character set, so the `cleveragents/plan-` prefix will not be mangled by sanitisation — verified by reading the regex definition. - The `_sanitise_branch_name()` fallback (empty input → `"sandbox"`) would produce `cleveragents/plan-sandbox`, which is still correctly namespaced under the `cleveragents/` prefix. The `plan_id` validation at the top of `create()` already rejects empty strings, so this fallback only triggers for strings composed entirely of disallowed characters — an extreme edge case. - No behavioral regressions: the change only affects the branch name string, not the worktree creation logic, commit flow, rollback, or cleanup. #### Test Quality ✅ - All 4 test fixture branch name strings in `git_worktree_coverage_boost_steps.py` correctly updated: - `sandbox/test` → `cleveragents/plan-test` - `sandbox/cleanup-test` → `cleveragents/plan-cleanup-test` - `sandbox/branch-delete-fail` → `cleveragents/plan-branch-delete-fail` - `garbage_collection.feature` scenario fixture updated: `sandbox/test-plan` → `cleveragents/plan-test-plan` - No test logic was altered — only expected branch name strings, which is correct for a naming convention fix. - Robot Framework integration tests (`robot/container_tool_exec.robot`) reference `/tmp/sandbox/` as a filesystem path, not a branch name — correctly left unchanged. #### PR Metadata & Commit Standards ✅ - **Commit message**: Conventional Changelog format (`fix(sandbox): ...`) with `ISSUES CLOSED: #2601` footer ✓ - **PR body**: Contains `Closes #2601` ✓ - **Label**: `Type/Bug` ✓ - **Milestone**: `v3.3.0` (matches issue) ✓ - **Single atomic commit**: Clean history ✓ - **Branch name**: `fix/git-worktree-branch-naming` ✓ ### Minor Observations (Non-blocking) 1. **Pre-existing: `_sanitise_branch_name()` fallback value** — The fallback value on line ~51 is still the string `"sandbox"`, a leftover from the old naming convention. While this is not introduced by this PR and the resulting branch name (`cleveragents/plan-sandbox`) is still correctly namespaced, a future cleanup could change this to something more semantically appropriate like `"unknown"` or `"default"`. Consider filing a low-priority follow-up issue. **Decision: APPROVED** ✅ --- **Automated by CleverAgents Bot** Supervisor: PR Review | Agent: ca-pr-self-reviewer
freemo merged commit e1fbcf6345 into master 2026-04-05 21:09:06 +00:00
freemo removed this from the v3.3.0 milestone 2026-04-07 00:11:51 +00:00
Sign in to join this conversation.
No reviewers
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!3263
No description provided.